1 | <?php |
||
2 | |||
3 | namespace Slides\Saml2; |
||
4 | |||
5 | /** |
||
6 | * Class ServiceProvider |
||
7 | * |
||
8 | * @package Slides\Saml2 |
||
9 | */ |
||
10 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
||
11 | { |
||
12 | /** |
||
13 | * Indicates if loading of the provider is deferred. |
||
14 | * |
||
15 | * @var bool |
||
16 | */ |
||
17 | protected $defer = false; |
||
18 | |||
19 | /** |
||
20 | * Bootstrap the application events. |
||
21 | * |
||
22 | * @return void |
||
23 | */ |
||
24 | public function boot() |
||
25 | { |
||
26 | $this->bootMiddleware(); |
||
27 | $this->bootRoutes(); |
||
28 | $this->bootPublishes(); |
||
29 | $this->bootCommands(); |
||
30 | $this->loadMigrations(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Bootstrap the routes. |
||
35 | * |
||
36 | * @return void |
||
37 | */ |
||
38 | protected function bootRoutes() |
||
39 | { |
||
40 | if($this->app['config']['saml2.useRoutes'] == true) { |
||
41 | include __DIR__ . '/Http/routes.php'; |
||
42 | } |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Bootstrap the publishable files. |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | protected function bootPublishes() |
||
51 | { |
||
52 | $source = __DIR__ . '/../config/saml2.php'; |
||
53 | |||
54 | $this->publishes([$source => config_path('saml2.php')]); |
||
55 | $this->mergeConfigFrom($source, 'saml2'); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Bootstrap the console commands. |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | protected function bootCommands() |
||
64 | { |
||
65 | $this->commands([ |
||
66 | \Slides\Saml2\Commands\CreateTenant::class, |
||
67 | \Slides\Saml2\Commands\UpdateTenant::class, |
||
68 | \Slides\Saml2\Commands\DeleteTenant::class, |
||
69 | \Slides\Saml2\Commands\RestoreTenant::class, |
||
70 | \Slides\Saml2\Commands\ListTenants::class, |
||
71 | \Slides\Saml2\Commands\TenantCredentials::class |
||
72 | ]); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Bootstrap the console commands. |
||
77 | * |
||
78 | * @return void |
||
79 | */ |
||
80 | protected function bootMiddleware() |
||
81 | { |
||
82 | $this->app['router']->aliasMiddleware('saml2.resolveTenant', \Slides\Saml2\Http\Middleware\ResolveTenant::class); |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Load the package migrations. |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | protected function loadMigrations() |
||
91 | { |
||
92 | if (config('saml2.load_migrations', true)) { |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
93 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
||
94 | } |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * Get the services provided by the provider. |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | public function provides() |
||
103 | { |
||
104 | return []; |
||
105 | } |
||
106 | } |
||
107 |