我想自己写一个注册,登录来锻炼自己,不适用laravel make:auth默认生成的,注册登录,在写登录的时候遇到了点问题,一下是我的代码片段,我想通过Auth提供的attempt来实现验证
···
if(Auth::attempt([ 'username' => $request->username,'password' => $request->password])){
//
return redirect('/');
}else{
//
}
···
报错内容
···
FatalThrowableError in EloquentUserProvider.php line 130:
Class '\App\User' not found
···
后来我把那个auth.php 的model改成我自己写model的路径,
···
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\Home\Users::class,
],
···
但是又出现新的报错
···
FatalThrowableError in EloquentUserProvider.php line 114:
Type error: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Models\Home\Users given, called in /home/vagrant/Code/Blog/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 385
···