我想自己写一个注册,登录来锻炼自己,不适用laravel make:auth默认生成的,注册登录,在写登录的时候遇到了点问题,一下是我的代码片段,我想通过Auth提供的attempt来实现验证
···
if(Auth::attempt([ 'username' => $request->username,'password' => $request->password])){
//
return redirect('/');
}else{
//
}
···
报错内容
···
FatalThrowableError in EloquentUserProvider.php line 130:
Class 'AppUser' 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 IlluminateAuthEloquentUserProvider::validateCredentials() must be an instance of IlluminateContractsAuthAuthenticatable, instance of AppModelsHomeUsers given, called in /home/vagrant/Code/Blog/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 385
···
上面大概的说类型错误,但是我传入的是数组,照文档上写的,还有一个问题就是auth.php,假如自己写改怎么配置,有没有相关的教程文档供参考之类的,多谢