Jwt-auth: Non-static method Tymon\JWTAuth\JWTAuth::fromUser() should not be called statically

Created on 24 Feb 2018  路  2Comments  路  Source: tymondesigns/jwt-auth

Non-static method Tymon\JWTAuth\JWTAuth::fromUser() should not be called statically

Hi
thanks for your great package. I recently update my packages and after that i got this exception when use JWTAuth::fromUser() ;
how can i fix this?
thanks.

Your environment

| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Laravel
| Framework version | 5.5
| Package version | 1.x.y
| PHP version | 7.2

Steps to reproduce

use JWTAuth::fromUser()

Expected behaviour

make a token from a user model.

Actual behaviour

throw an exception Non-static method Tymon\JWTAuth\JWTAuth::fromUser() should not be called statically

Most helpful comment

its because of use wrong namespace Tymon\JWTAuth\JWTAuth instead of JWTAuth ;

All 2 comments

its because of use wrong namespace Tymon\JWTAuth\JWTAuth instead of JWTAuth ;

You actually have to define the facade in app/config.php in order to use just JWTAuth;
so yeah, use JWTAuth; or alternatively : use Tymon\JWTAuth\Facades\JWTAuth;

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mihailo-misic picture mihailo-misic  路  3Comments

hfalucas picture hfalucas  路  3Comments

kofi1995 picture kofi1995  路  3Comments

CBR09 picture CBR09  路  3Comments

Rasoul-Karimi picture Rasoul-Karimi  路  3Comments