Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“拉雷维尔”;User.php第8行中的FatalErrorException:“;_Php_Laravel_Authentication_Laravel 5_Laravel 5.2 - Fatal编程技术网

“拉雷维尔”;User.php第8行中的FatalErrorException:“;

“拉雷维尔”;User.php第8行中的FatalErrorException:“;,php,laravel,authentication,laravel-5,laravel-5.2,Php,Laravel,Authentication,Laravel 5,Laravel 5.2,这意味着什么,我该如何修复它 FatalErrorException in User.php line 8: Class App\User contains 6 abstract methods and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Auth\Authenticatable::getAuthIdentifierName, Illuminate

这意味着什么,我该如何修复它

FatalErrorException in User.php line 8:
Class App\User contains 6 abstract methods and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Auth\Authenticatable::getAuthIdentifierName, Illuminate\Contracts\Auth\Authenticatable::getAuthIdentifier, Illuminate\Contracts\Auth\Authenticatable::getAuthPassword, ...)

这是在我尝试登录laravel应用程序的仪表板时发生的。

这是关于接口实现的。如果要实现该接口,需要提及接口声明的所有方法

照亮\Contracts\Auth\authenticable

接口定义:

interface Authenticatable {

    public function getAuthIdentifierName();
    public function getAuthIdentifier();
    public function getAuthPassword();
    public function getRememberToken();
    public function setRememberToken($value);
    public function getRememberTokenName();

}
因此,您的用户类必须具有上述方法

class User implements   Illuminate\Contracts\Auth\Authenticatable
{
    public function getAuthIdentifierName() {}
    public function getAuthIdentifier(){}
    public function getAuthPassword(){}
    public function getRememberToken(){}
    public function setRememberToken($value){}
    public function getRememberTokenName(){}

}
即使您不想在这些方法中编写代码,但仍然需要在用户类中编写空方法

解决方案:

  • 该接口主要用于Auth机制。如果不想用于Auth,只需从用户类中删除可验证的接口即可

  • 如果您需要将其用于Auth,则需要实现所有接口方法并使其正确。更多信息请访问以下网站:


  • 你能发布User.php类吗?看起来您的类没有实现抽象类中的某些方法。