DaftravelServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 6
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace UsamamuneerChaudhary\Daftravel;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class DaftravelServiceProvider extends ServiceProvider
8
{
9
    public function register(): void
10
    {
11
        $this->mergeConfigFrom(__DIR__ . '/../config/daftravel.php', 'daftravel');
12
13
        $this->app->singleton('daftravel', function ($app) {
14
            return new Daftravel($app['config']['daftravel']);
15
        });
16
17
        $this->app->alias('daftravel', Daftravel::class);
18
    }
19
20
    public function boot(): void
21
    {
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__ . '/../config/daftravel.php' => config_path('daftravel.php'),
25
            ], 'daftravel-config');
26
        }
27
    }
28
29
    public function provides(): array
30
    {
31
        return ['daftravel'];
32
    }
33
}
34