簡體   English   中英

默認用戶模型中的LARAVEL FatalErrorException

[英]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中,由於安全問題,對用戶模型進行了一些“重大”更改。

您需要按照以下升級說明來解決此問題。

  1. 首先,添加一個新的,可為null的VARCHAR(100),TEXT或等同於您的users表的Remember_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'; } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM