LaraClientServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 10
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 15
rs 9.9332
1
<?php
2
3
namespace Usamamuneerchaudhary\LaraClient;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
use Illuminate\Support\Facades\Route;
8
9
class LaraClientServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * @return void
13
     */
14
    public function register(): void
15
    {
16
        $this->mergeConfigFrom(__DIR__.'/../config/lara_client.php', 'lara_client');
17
    }
18
19
    /**
20
     * @return void
21
     */
22
    public function boot(): void
23
    {
24
        if ($this->app->runningInConsole()) {
25
            // Publish config file
26
            $this->publishes([
27
                __DIR__.'/../config/lara_client.php' => config_path('lara_client.php'),
28
            ], 'config');
29
            // Publish views
30
            $this->publishes([
31
                __DIR__.'/../resources/views' => resource_path('views/vendor/laraclient'),
32
            ], 'views');
33
        }
34
        $this->loadMigrationsFrom(__DIR__.'/../migrations');
35
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laraclient');
36
        $this->registerRoutes();
37
    }
38
39
    /**
40
     * @return void
41
     */
42
    protected function registerRoutes(): void
43
    {
44
        Route::group($this->routeConfiguration(), function () {
45
            $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
46
        });
47
    }
48
49
    /**
50
     * @return string[]
51
     */
52
    protected function routeConfiguration(): array
53
    {
54
        return [
55
            'prefix' => 'laraclient',
56
//            'middleware'=>''
57
        ];
58
    }
59
}
60