Has anyone encountered this problem
dd($this->user->check()); return false
but
Auth::guard('user')->attempt(App\User::find(1))
return the error
Call to undefined method Illuminate\Auth\TokenGuard::attempt()
Please help to resolve this problem.
I solved this problem
In config/auth.php
configuration:
'user' => [
'driver' => 'token',
'provider' => 'userProvider',
],
We need to change to:
'user' => [
'driver' => 'session',
'provider' => 'userProvider',
],
Because Auth::guard
data is stored in the session
And further work on the well-known scheme
Auth::login() = Auth::guard('user')->login()
Auth::attempt() = Auth::guard('user')->attempt()
Auth::user() = Auth::guard('user')->user()
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With