mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-12-05 04:45:32 -05:00
* Custom Multi DB User Provider * Multi DB Authentication provider * Finalized Multi Auth DB * Apply fixes from StyleCI (#22)
33 lines
754 B
PHP
33 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class AuthServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* The policy mappings for the application.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $policies = [
|
|
'App\Model' => 'App\Policies\ModelPolicy',
|
|
];
|
|
|
|
/**
|
|
* Register any authentication / authorization services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
$this->registerPolicies();
|
|
|
|
Auth::provider('multidb', function ($app, array $config) {
|
|
return new MultiDatabaseUserProvider($this->app['db']->connection(), $this->app['hash'], 'users');
|
|
});
|
|
}
|
|
}
|