DuckFunkCoreServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
1
<?php
2
3
namespace Torralbodavid\DuckFunkCore;
4
5
use Illuminate\Support\ServiceProvider;
6
use Laravel\Ui\UiServiceProvider;
7
use Torralbodavid\DuckFunkCore\Models\Arcturus\User;
8
use Torralbodavid\DuckFunkCore\Models\Housekeeping\News;
9
use Torralbodavid\DuckFunkCore\Observers\NewsObserver;
10
use Torralbodavid\DuckFunkCore\Observers\UserObserver;
11
12
class DuckFunkCoreServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap the application services.
16
     */
17
    public function boot()
18
    {
19
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'duck-funk-core');
20
        $this->loadViewsFrom(__DIR__.'/resources/views', 'duck-funk-core');
21
        $this->loadViewsFrom(__DIR__.'/resources/views/housekeeping', 'housekeeping');
22
        $this->loadViewsFrom(__DIR__.'/resources/views/auth', 'auth');
23
24
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
25
        $this->loadRoutesFrom(__DIR__.'/routes/duck-funk.php');
26
        $this->loadRoutesFrom(__DIR__.'/routes/duck-funk-api.php');
27
28
        $this->publishes([
29
            __DIR__.'/../config/config.php' => config_path('duck-funk.php'),
30
        ], 'duck-funk-core/config');
31
32
        $this->publishes([
33
            __DIR__.'/resources/views' => resource_path('views/vendor/duck-funk-core/'),
34
        ], 'duck-funk-core/views');
35
36
        $this->publishes([
37
            __DIR__.'/../public' => public_path('vendor/duck-funk-core'),
38
        ], 'duck-funk-core/assets');
39
40
        // Publishing the translation files.
41
        /*$this->publishes([
42
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/duck-funk-core'),
43
        ], 'lang');*/
44
45
        // Registering package commands.
46
        // $this->commands([]);
47
        User::observe(UserObserver::class);
48
        News::observe(NewsObserver::class);
49
    }
50
51
    /**
52
     * Register the application services.
53
     */
54
    public function register()
55
    {
56
        $this->app->register(UiServiceProvider::class);
57
        $this->app->register(DuckFunkEventServiceProvider::class);
58
        // Automatically apply the package configuration
59
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'duck-funk');
60
61
        // Register the main class to use with the facade
62
        $this->app->singleton('duck-funk-core', function () {
63
            return new DuckFunkCore;
64
        });
65
    }
66
}
67