PublicationsServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
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
}
60