php - Laravel 5.3 using multiple authentication (e.g admin, customer) -
i have read lot of threads multi-auth in laravel, of configurations see somehow complicated,  have seen multi-auth package not support laravel socialite. 
 aware question asked multiple times, if can give better answer. appreciated!
things have tried
i familiar laravel make:auth
i familiar laravel socialite facebook , twitter , google plus.
give try. still need basic knowledge laravel's new multitenancy.
in config/auth.php add
guardsarray:'customer' => [ 'driver' => 'session', 'provider' => 'customers', ],than in same file add
providersarray:'customers' => [ 'driver' => 'eloquent', 'model' => app\customer::class, ],than create migration
customers db table(you can use laravel's out of box migration users table)next eloquent model
app\customerthese included:use app\scopes\authorizedscope; use illuminate\foundation\auth\user authenticatable;
these should let use laravel's auth facade in app these used methods:
    auth::guard('customer')->attempt()     auth::guard('customer')->check()     auth::guard('customer')->logout()     auth::guard('customer')->user()   or use auth middleware this:
    route::get('customer/dashboard', function () {         // authenticated users may enter...     })->middleware('auth:customer');   also checkout these:
https://laravel.com/docs/5.3/authentication#authenticating-users
Comments
Post a Comment