Authentication with two different tables

9

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?

    
asked by anonymous 14.01.2014 / 04:31

2 answers

8

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.

    
14.01.2014 / 05:20
2

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() .

    
14.01.2014 / 04:49