andrewboy / LaravelMultiAuth by andrewboy

Laravel 5.1 package for laravel multi auth.
1,028
0
1
Package Data
Maintainer Username: andrewboy
Maintainer Contact: andras.jozsef.beck@gmail.com (Beck András)
Package Create Date: 2016-08-11
Package Last Update: 2016-08-15
Home Page:
Language: PHP
License: Unknown
Last Refreshed: 2024-11-23 03:09:45
Package Statistics
Total Downloads: 1,028
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Multi Auth for Laravel 5.1

This package can be use with only 5.1 version of laravel. This package extends the Kbwebs/MultiAuth package by overriding the default single laravel auth traits. With this package you can easily use the auth mechanism that laravel default offers.

Overwritten traits

AuthenticatesAndRegistersUsers

Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers

to

Andrewboy\LaravelMultiAuth\Traits\AuthenticatesAndRegistersUsers

AuthenticatesUsers

Illuminate\Foundation\Auth\AuthenticatesUsers

to

Andrewboy\LaravelMultiAuth\Traits\AuthenticatesUsers

RegistersUsers

Illuminate\Foundation\Auth\RegistersUsers

to

Andrewboy\LaravelMultiAuth\Traits\RegistersUsers

ResetsPasswords

Illuminate\Foundation\Auth\ResetsPasswords

to

Andrewboy\LaravelMultiAuth\Traits\ResetsPasswords

Installation steps

  1. First setup the Kbwebs/MultiAuth package

  2. In config/app.php set the provider:

    ...
    'providers' => [
        ...
        Andrewboy\LaravelMultiAuth\LaravelMultiAuthServiceProvider::class,
    ],
    ...
    
  3. Set the controllers

    AuthController

    use Andrewboy\LaravelMultiAuth\Traits\AuthenticatesAndRegistersUsers;
    
    class AuthController extends Controller
    {
        use AuthenticatesAndRegistersUsers, ThrottlesLogins;
        protected $entity = 'admin';
    
        ...
    }
    

    PasswordController

    use Andrewboy\LaravelMultiAuth\Traits\ResetsPasswords;
    
    class PasswordController extends Controller
    {
        use ResetsPasswords;
    
        protected $entity = 'admin';
    
        ...
    }
    

    Note: if you have only one entity, then you don't have to use the protected $entity property.