Dickyperdian's avatar

Argument 1 passed to Tymon\JWTAuth\JWT::fromUser()

hello, i need help to solvd, i trying to create login page with jwt, but i have error Type error: Argument 1 passed to Tymon\JWTAuth\JWT::fromUser() must be an instance of Tymon\JWTAuth\Contracts\JWTSubject, instance of App\User given, called in /home/kevinhermawan/Music/aspirasi-backoffice/vendor/tymon/jwt-auth/src/JWTAuth.php on line 54 my login script : https://pastebin.com/s15exnca

please help me,.... thanks

warning you talking with junior laravel..

0 likes
4 replies
Dickyperdian's avatar

like this? , but i got error Call to undefined method Illuminate\Database\Query\Builder::hasRole() (View: /home/kevinhermawan/Music/aspirasi-backoffice/resources/views/includes/sidebar.blade.php) (View: /home/kevinhermawan/Music/aspirasi-backoffice/resources/views/includes/sidebar.blade.php) (View: /home/kevinhermawan/Music/aspirasi-backoffice/resources/views/includes/sidebar.blade.php)

script login controller: https://pastebin.com/PDT08mtv

bobbybouwmann's avatar

The current exception is being thrown because you're calling hasRole on a query builder object instead of a User object.

Can you show your sidebar.blade.php file?

Please or to participate in this conversation.