Skeptical Ant
Skeptical Ant

Reputation: 384

Can't update a certain field Laravel Elequent

In the controller update method, I can update this field with no problem:

public function updateLecture($id){
    $subject = Subject::findOrFail($id);
    $subject->name = request('name');
    $subject->save();
}


But when I do try to update the description:

$subjet->description = request('description');

It gives me this error :

'Creating default object from empty value'

and I know for certain that the request('description') is not empty.

Upvotes: 0

Views: 47

Answers (1)

Md.Sukel Ali
Md.Sukel Ali

Reputation: 3065

You did spelling mistake,

$subject->description = request('description'); // make subjet to subject

Upvotes: 1

Related Questions