I am trying to call Eloquent\'s save() method on an existing record but getting an error from Illuminate\'s Query Builder.
Following the documentation on Laravel\'s web
Apparently the ->get()
method will not work with Eloquent's ->save()
method and you must use ->first()
instead.
Correct:
$this->employee = Employee::where('login', $login)->first();
Incorrect:
$this->employee = Employee::where('login', $login)->get();
See http://laravel.io/forum/06-04-2014-symfony-component-debug-exception-fatalerrorexception-call-to-undefined-method-illuminatedatabaseeloquentcollectionsave for additional reference.