我试图在现有记录上调用Eloquent的save()方法,但是从Illuminate的Query Builder中获取错误.
按照Laravel网站http://laravel.com/docs/eloquent#insert-update-delete上的文档更新检索到的模型,并查看此处的示例:Laravel Eloquent ORM save:update vs create,my code似乎遵循预期的约定,但我得到了这篇文章标题中提到的错误.
$this->employee = Employee::where('login', $login);
$this->employee->first_name = 'John';
$this->employee->last_name = 'Doe';
$this->employee->save();
Run Code Online (Sandbox Code Playgroud)
Employee类扩展了Eloquent,如果我创建了一个新的模型实例,然后设置了一些属性然后调用save()方法,它就可以很好地执行insert语句.我错过了什么?