Laravel 4.1 缺少 Illuminate\Database\Eloquent\Model::setAttribute() 的参数 2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23153446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Missing argument 2 for Illuminate\Database\Eloquent\Model::setAttribute() Laravel 4.1
提问by Mohammadov
Update :
更新 :
I have a problem in my logout action when i worked in Laravel 4 it works fin but in laravel 4.1 i have this error :
当我在 Laravel 4 中工作时,我的注销操作出现问题,但在 Laravel 4.1 中我有这个错误:
Missing argument 2 for Illuminate\Database\Eloquent\Model::setAttribute(),
called in
C:\Users\mohammed\workspace\mylittlebiz\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 2432 and defined
this is my action :
这是我的行动:
public function doLogout()
{
Auth::logout(); // log the user out of our application
return Redirect::to('login'); // redirect the user to the login screen
}
this is my model :
这是我的模型:
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Eloquent implements UserInterface, RemindableInterface {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
protected $hidden = array('password');
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return $this->getKey();
}
/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
return $this->password;
}
/**
* Get the e-mail address where password reminders are sent.
*
* @return string
*/
public function getReminderEmail()
{
return $this->email;
}
/* overriding actions from abstact class*/
public function getRememberToken(){}
public function setRememberToken($value){}
public function getRememberTokenName(){}
回答by heiligster
I had exactly the same issue ...
我有完全相同的问题...
Try to upgrade your methods in your Users model like this:
尝试像这样升级用户模型中的方法:
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
Also you may take a look at:
你也可以看看:
http://laravel.com/docs/upgrade
http://laravel.com/docs/upgrade
Philipp
菲利普