mercredi 9 mai 2018

Laravel 5.5 controller update function issue

I have the update function in the controller where I want to store the values of a form. Here is the code;

public function update(Request $request, $id=1){
        $data = array(); 

        $data->firstName=$request->get('firstName');
        $data->lastName=$request->get('lastName');
        $data->email=$request->get('email');
        $data->company=$request->get('company');
        $data->website=$request->get('website');
        UserAdmin::where('id', Auth::user()->id)->update($data);

        //return view('Administrator.profile.profile',$data);
        return redirect('administrator/myprofile');
    }

However, after submitting the form, it show me the error;

Attempt to assign property of non-object



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2I4LCkP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire