mardi 24 avril 2018

How to pull a user's class type on the fly. Laravel5

I'd like to automatically pull user's type from:

dd(class_basename(JWTAuth::toUser($token)));

It always returns User even though, some users are of type BusinessUser.

I have setup this in my auth.php:

'guards' => [
    'web' => [
        'driver'   => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver'   => 'token',
        'provider' => 'users',
    ],

    'business_api' => [
        'driver'   => 'passport',
        'provider' => 'business_users',
    ],
],

I don't want to create two routes for different user types. Thus, I'd like to pull user's class on the fly.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire