1 | <?php |
||
16 | class AdminLTETemplateServiceProvider extends ServiceProvider |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Register the application services. |
||
21 | */ |
||
22 | public function register() |
||
60 | |||
61 | /** |
||
62 | * Register Gravatar Service Provider. |
||
63 | */ |
||
64 | protected function registerGravatarServiceProvider() |
||
71 | |||
72 | /** |
||
73 | * Bootstrap the application services. |
||
74 | */ |
||
75 | public function boot(Router $router) |
||
104 | |||
105 | /** |
||
106 | * Define the AdminLTETemplate routes. |
||
107 | */ |
||
108 | protected function defineRoutes() |
||
118 | |||
119 | /** |
||
120 | * Publish Home Controller. |
||
121 | */ |
||
122 | private function publishHomeController() |
||
126 | |||
127 | /** |
||
128 | * Change default Laravel RegisterController. |
||
129 | */ |
||
130 | private function changeRegisterController() |
||
134 | |||
135 | /** |
||
136 | * Change default Laravel LoginController. |
||
137 | */ |
||
138 | private function changeLoginController() |
||
142 | |||
143 | /** |
||
144 | * Change default Laravel forgot password Controller. |
||
145 | */ |
||
146 | private function changeForgotPasswordController() |
||
150 | |||
151 | /** |
||
152 | * Publish no guest forgot password Controller. |
||
153 | */ |
||
154 | private function publishNoGuestForgotPasswordController() |
||
158 | |||
159 | /** |
||
160 | * Change default Laravel reset password Controller. |
||
161 | */ |
||
162 | private function changeResetPasswordController() |
||
166 | |||
167 | /** |
||
168 | * Publish public resource assets to Laravel project. |
||
169 | */ |
||
170 | private function publishPublicAssets() |
||
174 | |||
175 | /** |
||
176 | * Publish package views to Laravel project. |
||
177 | */ |
||
178 | private function publishViews() |
||
184 | |||
185 | /** |
||
186 | * Publish package resource assets to Laravel project. |
||
187 | */ |
||
188 | private function publishResourceAssets() |
||
192 | |||
193 | /** |
||
194 | * Publish package tests to Laravel project. |
||
195 | */ |
||
196 | private function publishTests() |
||
200 | |||
201 | /** |
||
202 | * Publish package language to Laravel project. |
||
203 | */ |
||
204 | private function publishLanguages() |
||
210 | |||
211 | /** |
||
212 | * Publish config Gravatar file using group. |
||
213 | */ |
||
214 | private function publishGravatar() |
||
218 | |||
219 | /** |
||
220 | * Publish adminlte package config. |
||
221 | */ |
||
222 | private function publishConfig() |
||
226 | |||
227 | /** |
||
228 | * Publish routes/web.php file. |
||
229 | */ |
||
230 | private function publishWebRoutes() |
||
234 | |||
235 | /** |
||
236 | * Publish routes/api.php file. |
||
237 | */ |
||
238 | private function publishApiRoutes() |
||
242 | |||
243 | /** |
||
244 | * Publish dusk tests files. |
||
245 | */ |
||
246 | private function publishDusk() |
||
250 | |||
251 | /** |
||
252 | * Publish dusk environment files. |
||
253 | */ |
||
254 | private function publishDuskEnvironment() |
||
258 | |||
259 | /** |
||
260 | * Publish database config files. |
||
261 | */ |
||
262 | private function publishDatabaseConfig() |
||
266 | |||
267 | /** |
||
268 | * Enable (if active) spatie menu. |
||
269 | */ |
||
270 | private function enableSpatieMenu() |
||
276 | } |
||
277 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the parent class: