我的身份验证系统不工作(使用laravel 5.1)。你能帮我吗?我是拉拉威尔的初学者,当然我忘了什么,但我不知道是什么。
我有这样的回应:
personne.php第10行中的致命错误异常:类未找到"App''Models''Eloquent"
我的身份.php:
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
// 'model' => App'User::class,
'model' => 'App'Models'personne',
我的个人类别:
namespace App'Models;
use Illuminate'Auth'Authenticatable;
use Illuminate'Database'Eloquent'Model;
use Illuminate'Auth'Passwords'CanResetPassword;
use Illuminate'Contracts'Auth'Authenticatable as AuthenticatableContract;
use Illuminate'Contracts'Auth'CanResetPassword as CanResetPasswordContract;
class personne extends Eloquent implements UserInterface, RemindableInterface {
protected $table = 'personne';
protected $primaryKey = 'id_personne';
public $timestamps = false; // pour ne pas que laravel update lui même les champs dates de la table
public function getReminderEmail()
{
return $this->email;
}
etc....
我的控制器:
namespace App'Http'Controllers;
use Illuminate'Support'Facades'Validator;
use Illuminate'Support'Facades'Input;
use Auth;
class AuthentificationController extends Controller {
编辑:我这样改了个人等级:
namespace App'Models;
use Eloquent;
use Illuminate'Auth'Authenticatable;
use Illuminate'Database'Eloquent'Model;
use Illuminate'Auth'Passwords'CanResetPassword;
use Illuminate'Contracts'Auth'Authenticatable as AuthenticatableContract;
use Illuminate'Contracts'Auth'CanResetPassword as CanResetPasswordContract;
class personne extends Model implements UserInterface, RemindableInterface {
现在的错误是:
personne.php第13行出现致命错误异常:未找到接口"App''Models''UserInterface"
您需要导入Eloquent Model类:
use Illuminate'Database'Eloquent'Model;
class personne extends Model implements UserInterface, RemindableInterface {
// ...
请遵守OOP指令,并使用大写字母作为类名Personne
中的第一个字母
你使用的是Laravel 5.1,下面是你如何使用雄辩的模型:eloquent Doc
您可以使用Laravel提供的开箱即用的身份验证系统,此处
答案是:
类"personne"必须以开头
namespace App'Models;
use Illuminate'Auth'Authenticatable;
use Illuminate'Database'Eloquent'Model;
use Illuminate'Auth'Passwords'CanResetPassword;
use Illuminate'Foundation'Auth'Access'Authorizable;
use Illuminate'Contracts'Auth'Authenticatable as AuthenticatableContract;
use Illuminate'Contracts'Auth'Access'Authorizable as AuthorizableContract;
use Illuminate'Contracts'Auth'CanResetPassword as CanResetPasswordContract;
class Personne extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, CanResetPassword;
现在一切都很好。多米尼克