Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| PublicationsServiceProvider | |
100.00% |
16 / 16 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| register | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
1 | |||
| boot | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| registerAdditionalServiceProviders | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Hyde\Publications; |
| 6 | |
| 7 | use Hyde\Foundation\HydeKernel; |
| 8 | use Illuminate\Support\Facades\Blade; |
| 9 | use Illuminate\Support\ServiceProvider; |
| 10 | use Illuminate\Validation\ValidationServiceProvider; |
| 11 | use Hyde\Publications\Providers\TranslationServiceProvider; |
| 12 | use Hyde\Publications\Views\Components\RelatedPublicationsComponent; |
| 13 | |
| 14 | use function resource_path; |
| 15 | |
| 16 | class PublicationsServiceProvider extends ServiceProvider |
| 17 | { |
| 18 | /** |
| 19 | * Register the application services. |
| 20 | */ |
| 21 | public function register(): void |
| 22 | { |
| 23 | $this->app->make(HydeKernel::class)->registerExtension(PublicationsExtension::class); |
| 24 | |
| 25 | $this->commands([ |
| 26 | Commands\MakePublicationTypeCommand::class, |
| 27 | Commands\MakePublicationCommand::class, |
| 28 | |
| 29 | Commands\ValidatePublicationTypesCommand::class, |
| 30 | Commands\ValidatePublicationsCommand::class, |
| 31 | Commands\SeedPublicationCommand::class, |
| 32 | ]); |
| 33 | |
| 34 | $this->registerAdditionalServiceProviders(); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Bootstrap the application services. |
| 39 | */ |
| 40 | public function boot(): void |
| 41 | { |
| 42 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'hyde-publications'); |
| 43 | |
| 44 | $this->publishes([ |
| 45 | __DIR__.'/../resources/views' => resource_path('views/vendor/hyde-publications'), |
| 46 | ], 'hyde-publications-views'); |
| 47 | |
| 48 | Blade::component('hyde-publications::related-publications', RelatedPublicationsComponent::class); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Register additional service providers. |
| 53 | */ |
| 54 | protected function registerAdditionalServiceProviders(): void |
| 55 | { |
| 56 | $this->app->register(TranslationServiceProvider::class); |
| 57 | $this->app->register(ValidationServiceProvider::class); |
| 58 | } |
| 59 | } |