dimanche 24 septembre 2017

Why does Laravel authentication require the 'web' guard?

I have setup Laravel 5.5 and installed the default authentication scaffolding.

My application has two types of users - customers and staff - so I prefer to name the authentication guards that way, and the following configuration seems to work.

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    'customers' => [
        'driver' => 'session',
        'provider' => 'customer-users',
    ],
    'staff' => [
        'driver' => 'session',
        'provider' => 'staff-users',
    ],
    'api' => [
        'driver' => 'token',
        'provider' => 'users',
    ],

My providers, customer-users and staff-users, use the standard eloquent driver, however they each return a different user type.

The problem is that I would like to remove the 'web' guard, since it's just cluttering the config file. When I do however, I get an exception somewhere deep in the Laravel middleware.

I can live with the extra clutter of course, but it does bother me that Laravel is relying on a configuration item that I can't change. Is this a Laravel bug, perhaps?

BTW - I don't have 'web' set as the default guard when I get the error...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xyADgN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire