Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing argument 2 for Illuminate\Database\Eloquent\Model::setAttribute() Laravel 4.1

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 :

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(){}
like image 287
Mohammadov Avatar asked Apr 18 '14 11:04

Mohammadov


1 Answers

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

Philipp

like image 128
heiligster Avatar answered Nov 15 '22 07:11

heiligster