DiscussServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 38

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 38
rs 9.312
c 0
b 0
f 0
1
<?php
2
3
namespace Seongbae\Discuss;
4
5
use Illuminate\Support\ServiceProvider;
6
use Seongbae\Discuss\Providers\EventServiceProvider;
7
8
class DiscussServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'discuss');
16
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
17
        $this->loadRoutesFrom(__DIR__.'/routes.php');
18
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'discuss');
19
20
        if ($this->app->runningInConsole()) {
21
            $this->publishes([
22
                __DIR__.'/../config/config.php' => config_path('discuss.php'),
23
            ], 'config');
24
25
//            $this->publishes([
26
//                __DIR__.'/../resources/js' => resource_path('js'),
27
//            ], 'js');
28
29
            $this->publishes([
30
                __DIR__.'/../resources/img' => public_path('vendor/discuss'),
31
            ], 'images');
32
33
            $this->publishes([
34
                __DIR__.'/../resources/views' => resource_path('views/vendor/discuss'),
35
            ], 'views');
36
37
            // Publishing assets.
38
            /*$this->publishes([
39
                __DIR__.'/../resources/assets' => public_path('vendor/discuss'),
40
            ], 'assets');*/
41
42
            // Publishing the translation files.
43
            /*$this->publishes([
44
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/discuss'),
45
            ], 'lang');*/
46
47
            // Registering package commands.
48
            // $this->commands([]);
49
        }
50
    }
51
52
    /**
53
     * Register the application services.
54
     */
55
    public function register()
56
    {
57
        // Automatically apply the package configuration
58
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'discuss');
59
60
        $this->app->register(EventServiceProvider::class);
61
62
        // Register helper
63
        $file = __DIR__.'/DiscussHelper.php';
64
        if (file_exists($file)) {
65
            require_once($file);
66
        }
67
68
        $this->app->bind('discuss',function(){
69
            return new Discuss();
70
        });
71
    }
72
}
73