PersonalDataExportServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Spatie\PersonalDataExport;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\ServiceProvider;
7
use Spatie\PersonalDataExport\Commands\CleanOldPersonalDataExportsCommand;
8
9
class PersonalDataExportServiceProvider extends ServiceProvider
10
{
11
    public function boot()
12
    {
13
        if ($this->app->runningInConsole()) {
14
            $this->publishes([
15
                __DIR__.'/../config/personal-data-export.php' => config_path('personal-data-export.php'),
16
            ], 'config');
17
18
            $this->publishes([
19
                __DIR__.'/../resources/views' => base_path('resources/views/vendor/personal-data-export'),
20
            ], 'views');
21
        }
22
23
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'personal-data-export');
24
25
        Route::macro('personalDataExports', function (string $url) {
26
            Route::get("$url/{zipFilename}", '\Spatie\PersonalDataExport\Http\Controllers\PersonalDataExportController@export')
27
                ->name('personal-data-exports');
28
        });
29
30
        $this->commands([
31
            CleanOldPersonalDataExportsCommand::class,
32
        ]);
33
    }
34
35
    public function register()
36
    {
37
        $this->mergeConfigFrom(__DIR__.'/../config/personal-data-export.php', 'personal-data-export');
38
    }
39
}
40