ApiJwtScaffoldServiceProvider::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 Lacasera\ApiJwtScaffold;
4
5
use Illuminate\Support\ServiceProvider;
6
use Lacasera\ApiJwtScaffold\Console\ScaffoldCommand;
7
use Lacasera\ApiJwtScaffold\Installers\InstallerContract;
8
use Lacasera\ApiJwtScaffold\Installers\LaravelPassportInstaller;
9
use Lacasera\ApiJwtScaffold\Installers\TymonJwtInstaller;
10
11
class ApiJwtScaffoldServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     */
16
    public function boot()
17
    {
18
19
        if ($this->app->runningInConsole()) {
20
            $this->publishes([
21
                __DIR__.'/../config/config.php' => config_path('api-jwt-scaffold.php'),
22
            ], 'config');
23
24
            // Registering package commands.
25
             $this->commands([ScaffoldCommand::class]);
26
        }
27
    }
28
29
    /**
30
     * Register the application services.
31
     */
32
    public function register()
33
    {
34
        // Automatically apply the package configuration
35
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'api-jwt-scaffold');
36
37
        // Register the main class to use with the facade
38
        $this->app->singleton('api-jwt-scaffold', function () {
39
            return new ApiJwtScaffold;
40
        });
41
42
        $this->app->bind(InstallerContract::class, LaravelPassportInstaller::class);
43
        $this->app->bind(InstallerContract::class, TymonJwtInstaller::class);
44
    }
45
}
46