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