GoodTillSystemServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 9.264
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace FLAIRUK\GoodTillSystem;
4
5
use Illuminate\Support\ServiceProvider;
6
use FLAIRUK\GoodTillSystem\Commands\SetupCommand;
7
8
class GoodTillSystemServiceProvider extends ServiceProvider
9
{
10
    protected $commands = [
11
        '\FLAIR\GoodTillSystem\Commands\SetupCommand',
12
    ];
13
14
    /**
15
     * Bootstrap the application services.
16
     */
17
    public function boot()
18
    {
19
        /*
20
         * Optional methods to load your package assets
21
         */
22
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'good-till-system');
23
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'good-till-system');
24
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
25
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
26
27
        if ($this->app->runningInConsole()) {
28
            $this->publishes([
29
                __DIR__.'/../config/config.php' => config_path('goodtill.php'),
30
            ], 'config');
31
32
            // $this->mergeConfigFrom(
33
            //     dirname(__DIR__).'/../config/config.php',
34
            //     config_path('goodtill.php')
35
            // );
36
37
38
            // Publishing the views.
39
            /*$this->publishes([
40
                __DIR__.'/../resources/views' => resource_path('views/vendor/good-till-system'),
41
            ], 'views');*/
42
43
            // Publishing assets.
44
            /*$this->publishes([
45
                __DIR__.'/../resources/assets' => public_path('vendor/good-till-system'),
46
            ], 'assets');*/
47
48
            // Publishing the translation files.
49
            /*$this->publishes([
50
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/good-till-system'),
51
            ], 'lang');*/
52
53
            // Registering package commands.
54
            // $this->commands([]);
55
56
        }
57
    }
58
59
    /**
60
     * Register the application services.
61
     */
62
    public function register()
63
    {
64
        // Automatically apply the package configuration
65
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'goodtill');
66
67
        // Register the main class to use with the facade
68
        $this->app->singleton('goodtillsystem', function () {
69
            return new GoodTillSystem;
0 ignored issues
show
Bug introduced by
The call to GoodTillSystem::__construct() misses some required arguments starting with $user.
Loading history...
70
        });
71
72
        if ($this->app->runningInConsole()) {
73
74
            $this->registerConsoleCommands();
75
        }
76
    }
77
78
    /**
79
     * Register Console Commands
80
     *
81
     * @return SetupCommand
82
     * @return InstallCommand
83
     * @return LearningLockerCommand
84
     */
85
    private function registerConsoleCommands()
86
    {
87
        $this->commands(SetupCommand::class);
88
    }
89
}
90