LaravelParatestServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Tonysm\LaravelParatest;
4
5
use Illuminate\Support\ServiceProvider;
6
use Tonysm\LaravelParatest\Console\DbCreateCommand as DbCreateCLICommand;
7
use Tonysm\LaravelParatest\Console\DbReCreateCommand as DbReCreateCLICommand;
8
use Tonysm\LaravelParatest\Console\DbDropCommand as DbDropCLICommand;
9
10
class LaravelParatestServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15
    public function boot()
16
    {
17
        if ($this->app->runningInConsole()) {
18
            $this->publishes([
19
                __DIR__.'/../config/config.php' => config_path('paratest.php'),
20
            ], 'config');
21
22
            // Registering package commands.
23
            $this->commands([
24
                DbCreateCLICommand::class,
25
                DbReCreateCLICommand::class,
26
                DbDropCLICommand::class,
27
            ]);
28
        }
29
    }
30
31
    /**
32
     * Register the application services.
33
     */
34
    public function register()
35
    {
36
        // Automatically apply the package configuration
37
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'paratest');
38
39
        // Register the main class to use with the facade
40
        $this->app->singleton('laravel-paratest', function () {
41
            return new LaravelParatest;
42
        });
43
    }
44
}
45