EventRevertServiceProvider::publishFiles()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 14
ccs 12
cts 12
cp 1
crap 1
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace Djunehor\EventRevert;
4
5
use Illuminate\Support\ServiceProvider as MyServiceProvider;
6
7
class EventRevertServiceProvider extends MyServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     *
12
     * @return void
13
     */
14 14
    public function boot()
15
    {
16 14
        $this->loadRoutesFrom(__DIR__.'/routes/web.php');
17 14
        $this->loadMigrationsFrom(__DIR__.'/database/migrations');
18 14
        $this->loadViewsFrom(__DIR__.'/resources/views', 'ModelEventLogger');
19 14
        $this->loadTranslationsFrom(__DIR__.'/resources/lang', 'ModelEventLogger');
20
21 14
        $this->publishFiles();
22 14
    }
23
24
    /**
25
     * Register the application services.
26
     *
27
     * @return void
28
     */
29 14
    public function register()
30
    {
31 14
        $this->app['router']->aliasMiddleware('model-event-logger-middleware', ModelEventLogMiddleware::class);
32 14
        $this->commands([
33 14
            RevertModelEvent::class,
34
        ]);
35 14
    }
36
37 14
    private function publishFiles()
38
    {
39 14
        $publishTag = 'ModelEventLogger';
40
41 14
        $this->publishes([
42 14
            __DIR__.'/resources/views' => base_path('resources/views/vendor/'.$publishTag),
43 14
        ], $publishTag);
44 14
        $this->publishes([
45 14
            __DIR__.'/resources/lang' => base_path('resources/lang/vendor/'.$publishTag),
46 14
        ], $publishTag);
47 14
        $this->publishes([
48 14
            __DIR__.'/config/model-event-logger.php' => config_path('model-event-logger.php'),
49 14
        ], $publishTag);
50 14
    }
51
}
52