| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Bootstrap the application services... |
||
| 15 | * |
||
| 16 | * @return void |
||
| 17 | */ |
||
| 18 | 67 | public function boot() |
|
| 19 | { |
||
| 20 | 67 | if ($this->app->runningInConsole()) { |
|
| 21 | 67 | $this->commands([ |
|
| 22 | 67 | MakeCommand::class, |
|
| 23 | ]); |
||
| 24 | } |
||
| 25 | |||
| 26 | 67 | $configPath = $this->configPath(); |
|
| 27 | |||
| 28 | 67 | $this->publishes([ |
|
| 29 | 67 | $configPath . '/config.php' => $this->publishPath('laravel-generator-package.php'), |
|
| 30 | 67 | ], 'config'); |
|
| 31 | |||
| 32 | 67 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
| 33 | 67 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Register the application services. |
||
| 37 | * |
||
| 38 | * @return void |
||
| 39 | * @throws Exception |
||
| 40 | */ |
||
| 41 | 67 | public function register() |
|
| 42 | { |
||
| 43 | $this->app->singleton(Configuration::class, function() { |
||
| 44 | 67 | return new Configuration; |
|
| 45 | 67 | }); |
|
| 46 | $this->app->bind(Field::class, function() { |
||
| 47 | 48 | return new Field(app(Configuration::class)); |
|
| 48 | 67 | }); |
|
| 49 | 67 | } |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | 67 | protected function configPath(): string |
|
| 55 | { |
||
| 56 | 67 | return __DIR__ . '/../config'; |
|
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param $configFile |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | 67 | protected function publishPath($configFile): string |
|
| 66 | } |
||
| 67 | } |
||
| 68 |