I need to do two authentications, one for other clients for admins, so I have to have two instances of auth; how to do this in Laravel, where do I have a client table and another admin table?
I need to do two authentications, one for other clients for admins, so I have to have two instances of auth; how to do this in Laravel, where do I have a client table and another admin table?
The most practical method is to configure authentication on the route where it is needed:
Config::set('auth.model', 'Admin');
Or, set to a standard URI's
if ($request->is('admin*'))
{
Config::set('auth.model', 'Admin');
}
In this way, Model Admin
will be responsible for authentication.
I believe it is the case of creating a new class of Auth Illuminate\Auth\Guard
and some Facades, to replicate the Auth component. Here you would do, for example, an authentication using Auth::attempt()
and another one using your authentication, MeuAuth::attempt()
.