ViewXrayServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace BeyondCode\ViewXray;
4
5
use View;
6
use Illuminate\Contracts\Http\Kernel;
7
use Illuminate\Support\ServiceProvider;
8
9
class ViewXrayServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        if ($this->app->runningInConsole()) {
17
            $this->publishes([
18
                __DIR__.'/../config/config.php' => config_path('xray.php'),
19
            ], 'config');
20
        }
21
22
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'xray');
23
24
        $this->registerMiddleware(XrayMiddleware::class);
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        $this->app->singleton(Xray::class);
33
34
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'xray');
35
    }
36
37
    /**
38
     * Register the middleware
39
     *
40
     * @param  string $middleware
41
     */
42
    protected function registerMiddleware($middleware)
43
    {
44
        $kernel = $this->app[Kernel::class];
45
        $kernel->pushMiddleware($middleware);
46
    }
47
}
48