jeudi 26 avril 2018

How do I find which `guard` made the current request in Laravel?

Here is my auth.php:

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

    'admin' => [
        'driver' => 'session',
        'provider' => 'admins',
    ],

],

Now, if both a user and an admin are logged-in in the same browser, how do I check which guard made the request?

Please note that both Auth::guard('admin')->check() and Auth::check() return true no matter who's making the request.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire