1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Acacha\AdminLTETemplateLaravel\Providers; |
4
|
|
|
|
5
|
|
|
use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; |
6
|
|
|
use Acacha\User\Providers\GuestUserProvider; |
7
|
|
|
use Creativeorange\Gravatar\Facades\Gravatar; |
8
|
|
|
use Creativeorange\Gravatar\GravatarServiceProvider; |
9
|
|
|
use Illuminate\Console\AppNamespaceDetectorTrait; |
10
|
|
|
use Illuminate\Support\ServiceProvider; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class AdminLTETemplateServiceProvider. |
14
|
|
|
*/ |
15
|
|
|
class AdminLTETemplateServiceProvider extends ServiceProvider |
16
|
|
|
{ |
17
|
|
|
use AppNamespaceDetectorTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Register the application services. |
21
|
|
|
*/ |
22
|
|
|
public function register() |
23
|
|
|
{ |
24
|
|
|
if (!defined('ADMINLTETEMPLATE_PATH')) { |
25
|
|
|
define('ADMINLTETEMPLATE_PATH', realpath(__DIR__.'/../../')); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
if ($this->app->runningInConsole()) { |
|
|
|
|
29
|
|
|
$this->commands([\Acacha\AdminLTETemplateLaravel\Console\PublishAdminLTE::class]); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
$this->app->bind('AdminLTE', function () { |
33
|
|
|
return new \Acacha\AdminLTETemplateLaravel\AdminLTE(); |
34
|
|
|
}); |
35
|
|
|
|
36
|
|
|
$this->app->register(GravatarServiceProvider::class); |
37
|
|
|
if (!class_exists('Gravatar')) { |
38
|
|
|
class_alias(Gravatar::class, 'Gravatar'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
$this->app->register(GuestUserProvider::class); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Bootstrap the application services. |
46
|
|
|
*/ |
47
|
|
|
public function boot() |
48
|
|
|
{ |
49
|
|
|
$this->defineRoutes(); |
50
|
|
|
$this->publishHomeController(); |
51
|
|
|
$this->changeRegisterController(); |
52
|
|
|
$this->changeLoginController(); |
53
|
|
|
$this->changeForgotPasswordController(); |
54
|
|
|
$this->changeResetPasswordController(); |
55
|
|
|
$this->publishPublicAssets(); |
56
|
|
|
$this->publishViews(); |
57
|
|
|
$this->publishResourceAssets(); |
58
|
|
|
$this->publishTests(); |
59
|
|
|
$this->publishLanguages(); |
60
|
|
|
$this->publishGravatar(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Define the AdminLTETemplate routes. |
65
|
|
|
*/ |
66
|
|
|
protected function defineRoutes() |
67
|
|
|
{ |
68
|
|
|
if (!$this->app->routesAreCached()) { |
|
|
|
|
69
|
|
|
$router = app('router'); |
70
|
|
|
|
71
|
|
|
$router->group(['namespace' => $this->getAppNamespace().'Http\Controllers'], function () { |
72
|
|
|
require __DIR__.'/../Http/routes.php'; |
73
|
|
|
}); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Publish Home Controller. |
79
|
|
|
*/ |
80
|
|
|
private function publishHomeController() |
81
|
|
|
{ |
82
|
|
|
$this->publishes(AdminLTE::homeController(), 'adminlte'); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Change default Laravel RegisterController. |
87
|
|
|
*/ |
88
|
|
|
private function changeRegisterController() |
89
|
|
|
{ |
90
|
|
|
$this->publishes(AdminLTE::registerController(), 'adminlte'); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Change default Laravel LoginController. |
95
|
|
|
*/ |
96
|
|
|
private function changeLoginController() |
97
|
|
|
{ |
98
|
|
|
$this->publishes(AdminLTE::loginController(), 'adminlte'); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Change default Laravel forgot password Controller. |
103
|
|
|
*/ |
104
|
|
|
private function changeForgotPasswordController() |
105
|
|
|
{ |
106
|
|
|
$this->publishes(AdminLTE::forgotPasswordController(), 'adminlte'); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Change default Laravel reset password Controller. |
111
|
|
|
*/ |
112
|
|
|
private function changeResetPasswordController() |
113
|
|
|
{ |
114
|
|
|
$this->publishes(AdminLTE::resetPasswordController(), 'adminlte'); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Publish public resource assets to Laravel project. |
119
|
|
|
*/ |
120
|
|
|
private function publishPublicAssets() |
121
|
|
|
{ |
122
|
|
|
$this->publishes(AdminLTE::publicAssets(), 'adminlte'); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Publish package views to Laravel project. |
127
|
|
|
*/ |
128
|
|
|
private function publishViews() |
129
|
|
|
{ |
130
|
|
|
$this->loadViewsFrom(ADMINLTETEMPLATE_PATH.'/resources/views/', 'adminlte'); |
131
|
|
|
|
132
|
|
|
$this->publishes(AdminLTE::views(), 'adminlte'); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Publish package resource assets to Laravel project. |
137
|
|
|
*/ |
138
|
|
|
private function publishResourceAssets() |
139
|
|
|
{ |
140
|
|
|
$this->publishes(AdminLTE::resourceAssets(), 'adminlte'); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Publish package tests to Laravel project. |
145
|
|
|
*/ |
146
|
|
|
private function publishTests() |
147
|
|
|
{ |
148
|
|
|
$this->publishes(AdminLTE::tests(), 'adminlte'); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Publish package language to Laravel project. |
153
|
|
|
*/ |
154
|
|
|
private function publishLanguages() |
155
|
|
|
{ |
156
|
|
|
$this->loadTranslationsFrom(ADMINLTETEMPLATE_PATH.'/resources/lang/', 'adminlte_lang'); |
157
|
|
|
|
158
|
|
|
$this->publishes(AdminLTE::languages(), 'adminlte'); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Publish config Gravatar file using group. |
163
|
|
|
*/ |
164
|
|
|
private function publishGravatar() |
165
|
|
|
{ |
166
|
|
|
$this->publishes(AdminLTE::gravatar(), 'adminlte'); |
167
|
|
|
} |
168
|
|
|
} |
169
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.