dev-develop
dev-develop https://github.com/chazzuka/authronmulti tenant auth manager for laravel
MIT
The Requires
- php >=5.4.0
- illuminate/support 5.0.*
by chz
laravel php auth
Wallogit.com
2017 © Pedro Peláez
multi tenant auth manager for laravel
add multi tenant auth configuration at config/auth.php, (*1)
'resolver' => [
'default' => 'member',
'member' => [
'driver' => 'eloquent',
'model' => 'App\Account\Member',
],
'audience' => [
'driver' => 'audience',
'model' => 'App\Audiences\Audience',
],
],
Replace laravel auth provider in config/app.php with Chazzuka\Authron\AuthronServiceProvider, (*2)
// login with default auth manager Auth::attempt($crendetials); Auth::guest(); Auth::check(); // above is equivalent to Auth::member()->attempt($credentials); Auth::member()->guest(); Auth::member()->check(); // login audience Auth::audience()->attempt($credentials); Auth::audience()->guest(); Auth::audience()->check();
Register custom user provider, (*3)
// Register only for audience auth manager
$this->app['auth']->audience()->extend('audience', function ()
{
$provider = new AudienceProvider($this->app['audiences']);
return new Guard('audience', $provider, $this->app['session.store']);
});
// register for all registered managers
$this->app['auth']->extend('audience', function ()
{
$provider = new AudienceProvider($this->app['audiences']);
return new Guard('audience', $provider, $this->app['session.store']);
});
multi tenant auth manager for laravel
MIT
laravel php auth