gpt4 book ai didi

php - Illuminate\Database\Eloquent\Model::setAttribute() Laravel 4.1 缺少参数 2

转载 作者:可可西里 更新时间:2023-11-01 13:13:17 27 4
gpt4 key购买 nike

更新:

当我在 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

这是我的 Action :

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(){}

最佳答案

我遇到了完全相同的问题......

尝试像这样升级用户模型中的方法:

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

菲利普

关于php - Illuminate\Database\Eloquent\Model::setAttribute() Laravel 4.1 缺少参数 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23153446/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com