slim12kg

slim12kg

Member Since 4 Years Ago

Experience Points 225
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

25 Jan
3 years ago
23 Jan
3 years ago

slim12kg started a new conversation CURL Error 60: SSL Certificate Problem: Unable To Get Local Issuer Certificate

I just installed mandrill and tried sending a message using the Maill::Send function but i get the error ": cURL error 60: SSL certificate problem: unable to get local issuer certificate". I actually thought it was a problem with curl not on my windows, so i installed curl and a certificated, yet it persist. Any idea what might be the problem?

24 Nov
4 years ago

slim12kg started a new conversation Controller Saving Last Data In Array

Have asked this question before but it wasn't answered.So am asking again.I have a table subjects with columns:

id->primary key,auto-increment;
class_id->foreign key->refrences id on classes table;
subject;
and a users table:
id->primary key,auto-increment;
username;
password;
and a classes table:
id->primary,autoincrement;
class;
term;
and a pivot table student_user: 
id->primary;
user_id->refrences id on users table;
subject_id->refrences id on subject table;
class_id->foreign,refrences id on classes table;

And i have my model to define there relationship thus

//User Model 
//User.php



public function subjects()
    {
    return $this->belongsToMany('Subject');
    }

    public function myclass()
    {
        return $this->belongsTo('SchoolClass');
    }

//Class Model
//SchoolClass.php



 public function subjects()
    {
    return $this->hasMany('Subject','class_id');
    }

//Subject Model
//Subject.php
public function term()
    {
    return $this->belongsTo('SchoolClass');
    }

    public function student()
    {
    return $this->belongsToMany('User');
    }

Now here comes the problem.When ever i try to insert data into the pivot table subject_user,only the the last data in the array of values that i want to insert gets saved into the database.I dont know if its the foreign constraint keys that's only updating the row instead of inserting a new one when looping through data.I cant figure out what is wrong.And below is my controller to see how my data is been inserted.Am not very conversant with relationships in laravel

//Save Registered Courses


public function post_proceed_registration()
        {
            $PageTitle = 'Register Subjects';
            $id        = Auth::user()->id;
            $User      = User::find($id);
            $class_id  = $User->profile->class_id;
            $subjects  = Input::get('subjects');
            $registration = RegistrationCheck::where('class_id',$class_id)->where('user_id',$id)->pluck('status');

            if(count(Input::get('students')) != 0)
            {
                if($registration == 'true')
                {
                PivotSubject::where('user_id',$id)->where('class_id',$class_id)->delete();

                foreach($subjects as $sub_id)
                    {
                        $subject = new PivotSubject;

                        $subject->user_id = $id;
                        $subject->subject_id = $sub_id;
                        $subject->class_id   = $class_id;

                        $subject->save();
                    }

                RegistrationCheck::where('class_id',$class_id)->where('user_id',$id)->update(['status'=>'false']);

                return Response::Json('Success: Subject/Courses Registered');
                }
            return Response::Json('Error: You already registered for this Term/Semester.Please Contact ICT for help');
            }
            return Response::Json('Error:You did not choose any course to register');
        }

Am stucked here.Any help would be appreciated