Laravel2stepServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 66
c 0
b 0
f 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A publishFiles() 0 27 1
A boot() 0 4 1
A register() 0 7 1
1
<?php
2
3
namespace jeremykenedy\laravel2step;
4
5
use Illuminate\Routing\Router;
6
use Illuminate\Support\ServiceProvider;
7
use jeremykenedy\laravel2step\App\Http\Middleware\Laravel2step;
8
9
class Laravel2stepServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Indicates if loading of the provider is deferred.
13
     *
14
     * @var bool
15
     */
16
    protected $defer = false;
17
18
    /**
19
     * Bootstrap the application services.
20
     *
21
     * @return void
22
     */
23
    public function boot(Router $router)
24
    {
25
        $router->middlewareGroup('twostep', [Laravel2step::class]);
26
        $this->loadTranslationsFrom(__DIR__.'/resources/lang/', 'laravel2step');
27
    }
28
29
    /**
30
     * Register the application services.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->loadRoutesFrom(__DIR__.'/routes/web.php');
37
        $this->loadViewsFrom(__DIR__.'/resources/views/', 'laravel2step');
38
        $this->loadMigrationsFrom(__DIR__.'/database/migrations');
39
        $this->mergeConfigFrom(__DIR__.'/config/laravel2step.php', 'laravel2step');
40
        $this->publishFiles();
41
    }
42
43
    /**
44
     * Publish files for Laravel 2-Step Verification.
45
     *
46
     * @return void
47
     */
48
    private function publishFiles()
49
    {
50
        $publishTag = 'laravel2step';
51
52
        $this->publishes([
53
            __DIR__.'/config/laravel2step.php' => base_path('config/laravel2step.php'),
54
        ], $publishTag);
55
56
        $this->publishes([
57
            __DIR__.'/database/migrations/' => base_path('/database/migrations'),
58
        ], $publishTag);
59
60
        $this->publishes([
61
            __DIR__.'/public/css' => public_path('css/laravel2step'),
62
        ], $publishTag);
63
64
        $this->publishes([
65
            __DIR__.'/resources/assets/scss' => resource_path('assets/scss/laravel2step'),
66
        ], $publishTag);
67
68
        $this->publishes([
69
            __DIR__.'/resources/views' => resource_path('views/vendor/laravel2step'),
70
        ], $publishTag);
71
72
        $this->publishes([
73
            __DIR__.'/resources/lang' => base_path('resources/lang/vendor/laravel2step'),
74
        ], $publishTag);
75
    }
76
}
77