|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace jeremykenedy\laravelusers; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
|
6
|
|
|
|
|
7
|
|
|
class LaravelUsersServiceProvider extends ServiceProvider |
|
8
|
|
|
{ |
|
9
|
|
|
private $_packageTag = 'laravelusers'; |
|
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() |
|
24
|
|
|
{ |
|
25
|
|
|
$this->loadTranslationsFrom(__DIR__.'/resources/lang/', $this->_packageTag); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Register the application services. |
|
30
|
|
|
* |
|
31
|
|
|
* @return void |
|
32
|
|
|
*/ |
|
33
|
|
|
public function register() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->loadRoutesFrom(__DIR__.'/routes/web.php'); |
|
36
|
|
|
$this->loadViewsFrom(__DIR__.'/resources/views/', $this->_packageTag); |
|
37
|
|
|
$this->mergeConfigFrom(__DIR__.'/config/'.$this->_packageTag.'.php', $this->_packageTag); |
|
38
|
|
|
$this->publishFiles(); |
|
39
|
|
|
$this->app->make('jeremykenedy\laravelusers\App\Http\Controllers\UsersManagementController'); |
|
40
|
|
|
$this->app->singleton(jeremykenedy\laravelusers\App\Http\Controllers\UsersManagementController\UsersManagementController::class, function () { |
|
41
|
|
|
return new App\Http\Controllers\UsersManagementController(); |
|
42
|
|
|
}); |
|
43
|
|
|
$this->app->alias(UsersManagementController::class, 'laravelusers'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Publish files for the package. |
|
48
|
|
|
* |
|
49
|
|
|
* @return void |
|
50
|
|
|
*/ |
|
51
|
|
|
private function publishFiles() |
|
52
|
|
|
{ |
|
53
|
|
|
$publishTag = $this->_packageTag; |
|
54
|
|
|
|
|
55
|
|
|
$this->publishes([ |
|
56
|
|
|
__DIR__.'/config/'.$this->_packageTag.'.php' => base_path('config/'.$this->_packageTag.'.php'), |
|
57
|
|
|
], $publishTag); |
|
58
|
|
|
|
|
59
|
|
|
$this->publishes([ |
|
60
|
|
|
__DIR__.'/resources/views' => resource_path('views/vendor/'.$this->_packageTag), |
|
61
|
|
|
], $publishTag); |
|
62
|
|
|
|
|
63
|
|
|
$this->publishes([ |
|
64
|
|
|
__DIR__.'/resources/lang' => resource_path('lang/vendor/'.$this->_packageTag), |
|
65
|
|
|
], $publishTag); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|