2018-10-04 19:10:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2018-10-15 07:00:48 +02:00
|
|
|
use Illuminate\Support\Facades\Gate;
|
2018-10-04 19:10:43 +02:00
|
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
2018-10-15 07:00:48 +02:00
|
|
|
use Auth;
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2018-10-08 11:38:45 +02:00
|
|
|
Auth::provider('multidb', function ($app, array $config) {
|
2018-10-15 07:00:48 +02:00
|
|
|
return new MultiDatabaseUserProvider($this->app['db']->connection(), $this->app['hash']);
|
2018-10-08 11:38:45 +02:00
|
|
|
});
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|
|
|
|
}
|