|
2 | 2 |
|
3 | 3 | namespace Lauthz; |
4 | 4 |
|
| 5 | +use Illuminate\Support\ServiceProvider; |
5 | 6 | use Lauthz\Models\Rule; |
6 | 7 | use Lauthz\Observers\RuleObserver; |
7 | | -use Illuminate\Support\ServiceProvider; |
8 | 8 |
|
9 | | -class LauthzServiceProvider extends ServiceProvider |
10 | | -{ |
11 | | - /** |
12 | | - * Perform post-registration booting of services. |
13 | | - */ |
14 | | - public function boot() |
15 | | - { |
16 | | - if ($this->app->runningInConsole()) { |
17 | | - $this->publishes([__DIR__.'/../database/migrations' => database_path('migrations')], 'laravel-lauthz-migrations'); |
18 | | - $this->publishes([__DIR__.'/../config/lauthz-rbac-model.conf' => config_path('lauthz-rbac-model.conf')], 'laravel-lauthz-config'); |
19 | | - $this->publishes([__DIR__.'/../config/lauthz.php' => config_path('lauthz.php')], 'laravel-lauthz-config'); |
20 | | - |
21 | | - $this->commands([ |
22 | | - Commands\PolicyAdd::class, |
23 | | - Commands\RoleAssign::class, |
24 | | - ]); |
25 | | - } |
26 | | - |
27 | | - $this->mergeConfigFrom(__DIR__.'/../config/lauthz.php', 'lauthz'); |
28 | | - |
29 | | - $this->bootObserver(); |
30 | | - } |
31 | | - |
32 | | - /** |
33 | | - * Boot Observer. |
34 | | - * |
35 | | - * @return void |
36 | | - */ |
37 | | - protected function bootObserver() |
38 | | - { |
39 | | - Rule::observe(new RuleObserver()); |
40 | | - } |
41 | | - |
42 | | - /** |
43 | | - * Register bindings in the container. |
44 | | - */ |
45 | | - public function register() |
46 | | - { |
47 | | - $this->app->singleton('enforcer', function ($app) { |
48 | | - return new EnforcerManager($app); |
49 | | - }); |
50 | | - } |
| 9 | +class LauthzServiceProvider extends ServiceProvider { |
| 10 | + /** |
| 11 | + * Perform post-registration booting of services. |
| 12 | + */ |
| 13 | + public function boot() { |
| 14 | + if ($this->app->runningInConsole()) { |
| 15 | + $this->publishes([__DIR__ . '/../database/migrations' => database_path('migrations')], 'laravel-lauthz-migrations'); |
| 16 | + $this->publishes([__DIR__ . '/../config/lauthz-rbac-model.conf' => config_path('lauthz-rbac-model.conf')], 'laravel-lauthz-config'); |
| 17 | + $this->publishes([__DIR__ . '/../config/lauthz.php' => config_path('lauthz.php')], 'laravel-lauthz-config'); |
| 18 | + |
| 19 | + $this->commands([ |
| 20 | + Commands\GroupAdd::class, |
| 21 | + Commands\PolicyAdd::class, |
| 22 | + Commands\RoleAssign::class, |
| 23 | + ]); |
| 24 | + } |
| 25 | + |
| 26 | + $this->mergeConfigFrom(__DIR__ . '/../config/lauthz.php', 'lauthz'); |
| 27 | + |
| 28 | + $this->bootObserver(); |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Boot Observer. |
| 33 | + * |
| 34 | + * @return void |
| 35 | + */ |
| 36 | + protected function bootObserver() { |
| 37 | + Rule::observe(new RuleObserver()); |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Register bindings in the container. |
| 42 | + */ |
| 43 | + public function register() { |
| 44 | + $this->app->singleton('enforcer', function ($app) { |
| 45 | + return new EnforcerManager($app); |
| 46 | + }); |
| 47 | + } |
51 | 48 | } |
0 commit comments