slim12kg

Experience

225

0 Best Reply Awards

  • Member Since 3 Years Ago
  • 0 Lessons Completed
  • 0 Favorites

25th January, 2015

slim12kg left a reply on CURL Error 60: SSL Certificate Problem: Unable To Get Local Issuer Certificate • 3 years ago

@bashy Please how do i this.Am using a windows OS

23rd January, 2015

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

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?

24th November, 2014

slim12kg started a new conversation Controller Saving Last Data In Array • 3 years ago

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

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.