更新:
我在退出行动中遇到问题,当我在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
这是我的行动:
public function doLogout()
{
Auth::logout(); // log the user out of our application
return Redirect::to('login'); // redirect the user to the login screen
}
这是我的模特:
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(){}
答案 0 :(得分:11)
我有完全相同的问题...
尝试升级您的用户模型中的方法,如下所示:
public function getRememberToken()
{
return $this->remember_token;
}
public function setRememberToken($value)
{
$this->remember_token = $value;
}
public function getRememberTokenName()
{
return 'remember_token';
}
你也可以看看:
http://laravel.com/docs/upgrade
菲利普