Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
PublicationsServiceProvider
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 register
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
 boot
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 registerAdditionalServiceProviders
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Publications;
6
7use Hyde\Foundation\HydeKernel;
8use Illuminate\Support\Facades\Blade;
9use Illuminate\Support\ServiceProvider;
10use Illuminate\Validation\ValidationServiceProvider;
11use Hyde\Publications\Providers\TranslationServiceProvider;
12use Hyde\Publications\Views\Components\RelatedPublicationsComponent;
13
14use function resource_path;
15
16class 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}