|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace KeyShang\AuthenticationLog; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Contracts\Events\Dispatcher; |
|
6
|
|
|
use Illuminate\Support\ServiceProvider; |
|
7
|
|
|
|
|
8
|
|
|
class AuthenticationLogServiceProvider extends ServiceProvider |
|
9
|
|
|
{ |
|
10
|
|
|
use EventMap; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Bootstrap the application services. |
|
14
|
|
|
* |
|
15
|
|
|
* @return void |
|
16
|
|
|
*/ |
|
17
|
|
|
public function boot() |
|
18
|
|
|
{ |
|
19
|
|
|
$this->registerEvents(); |
|
20
|
|
|
|
|
21
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'authentication-log'); |
|
22
|
|
|
|
|
23
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'authentication-log'); |
|
24
|
|
|
|
|
25
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/authentication-log.php', 'authentication-log'); |
|
26
|
|
|
|
|
27
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
28
|
|
|
|
|
29
|
|
|
if ($this->app->runningInConsole()) { |
|
30
|
|
|
$this->publishes([ |
|
31
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/authentication-log'), |
|
32
|
|
|
], 'authentication-log-views'); |
|
33
|
|
|
|
|
34
|
|
|
$this->publishes([ |
|
35
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/authentication-log'), |
|
36
|
|
|
], 'authentication-log-translations'); |
|
37
|
|
|
|
|
38
|
|
|
$this->publishes([ |
|
39
|
|
|
__DIR__.'/../config/authentication-log.php' => config_path('authentication-log.php'), |
|
40
|
|
|
], 'authentication-log-config'); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Register the Authentication Log's events. |
|
46
|
|
|
* |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
|
|
protected function registerEvents() |
|
50
|
|
|
{ |
|
51
|
|
|
$events = $this->app->make(Dispatcher::class); |
|
52
|
|
|
|
|
53
|
|
|
foreach ($this->events as $event => $listeners) { |
|
54
|
|
|
foreach ($listeners as $listener) { |
|
55
|
|
|
$events->listen($event, $listener); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Register the application services. |
|
62
|
|
|
* |
|
63
|
|
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
|
|
public function register() |
|
66
|
|
|
{ |
|
67
|
|
|
if ($this->app->runningInConsole()) { |
|
68
|
|
|
$this->commands([ |
|
69
|
|
|
Console\ClearCommand::class, |
|
70
|
|
|
]); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|