默认用户模型中的LARAVEL fatalerroreexception


LARAVEL FatalErrorException in default User model

登录默认User模型后,我得到这个错误:

        Symfony ' Component ' Debug ' Exception ' FatalErrorException
        Class User contains 3 abstract methods and must therefore be declared abstract 
        or implement the remaining methods (Illuminate'Auth'UserInterface::getRememberToken, 
        Illuminate'Auth'UserInterface::setRememberToken,
        Illuminate'Auth'UserInterface::getRememberTokenName)
用户:

<?php
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';
    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    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;
    }
}

这个版本的Laravel:

Laravel Framework version 4.1.29

您已经完成了编译器更新—并且从低于4.1.26的版本升级到4.1.29。在4.1.26中,由于安全问题,对User模型进行了一些"破坏性"更改。

您需要按照这些升级说明来解决问题。

  1. 首先,在你的users表中添加一个新的、可空的VARCHAR(100)、TEXT或等价的memor_token。

  2. 接下来,如果您正在使用Eloquent身份验证驱动程序,使用以下三个方法更新User类:

    public function getRememberToken()
    {
        return $this->remember_token;
    }
    public function setRememberToken($value)
    {
        $this->remember_token = $value;
    }
    public function getRememberTokenName()
    {
        return 'remember_token';
    }