【发布时间】:2014-08-18 22:44:26
【问题描述】:
我在尝试保存我的模型后收到此错误。这是我得到的错误:
调用未定义的方法 Illuminate\Database\Query\Builder::save()
这是我的代码:
public function getActivate ($code)
{
$user = User::where('code','=',$code)->where('active','=',0);
if ($user->count())
{
$user->first();
//Update user to active state
$user->active = 1;
$user->code ='';
if($user->save())
{
return Redirect::route('home')
->with('global', 'Account Activated ! You can sign in ');
}
}
return Redirect::route('home')
->with('global', 'We could not activate your account. Try again later');
}
我的 Laravel 版本是稳定版。
【问题讨论】: