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
|
|
|
|