1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* NOTICE OF LICENSE |
5
|
|
|
* |
6
|
|
|
* Part of the Rinvex Fort Package. |
7
|
|
|
* |
8
|
|
|
* This source file is subject to The MIT License (MIT) |
9
|
|
|
* that is bundled with this package in the LICENSE file. |
10
|
|
|
* |
11
|
|
|
* Package: Rinvex Fort Package |
12
|
|
|
* License: The MIT License (MIT) |
13
|
|
|
* Link: https://rinvex.com |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Rinvex\Fort\Listeners; |
17
|
|
|
|
18
|
|
|
use Illuminate\Http\Request; |
19
|
|
|
use Rinvex\Fort\Models\Role; |
20
|
|
|
use Rinvex\Fort\Models\User; |
21
|
|
|
use Rinvex\Fort\Models\Ability; |
22
|
|
|
use Rinvex\Fort\Models\Persistence; |
23
|
|
|
use Illuminate\Database\Eloquent\Model; |
24
|
|
|
use Illuminate\Contracts\Events\Dispatcher; |
25
|
|
|
use Illuminate\Contracts\Container\Container; |
26
|
|
|
use Rinvex\Fort\Contracts\RoleRepositoryContract; |
27
|
|
|
use Rinvex\Fort\Contracts\UserRepositoryContract; |
28
|
|
|
use Rinvex\Fort\Contracts\AuthenticatableContract; |
29
|
|
|
use Rinvex\Fort\Contracts\AbilityRepositoryContract; |
30
|
|
|
use Rinvex\Fort\Contracts\PersistenceRepositoryContract; |
31
|
|
|
use Rinvex\Fort\Notifications\RegistrationSuccessNotification; |
32
|
|
|
use Rinvex\Fort\Notifications\VerificationSuccessNotification; |
33
|
|
|
use Rinvex\Fort\Notifications\AuthenticationLockoutNotification; |
34
|
|
|
|
35
|
|
|
class FortEventListener |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* The container instance. |
39
|
|
|
* |
40
|
|
|
* @var \Illuminate\Container\Container |
41
|
|
|
*/ |
42
|
|
|
protected $app; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Create a new fort event listener instance. |
46
|
|
|
* |
47
|
|
|
* @param \Illuminate\Contracts\Container\Container $app |
48
|
|
|
*/ |
49
|
|
|
public function __construct(Container $app) |
50
|
|
|
{ |
51
|
|
|
$this->app = $app; |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Register the listeners for the subscriber. |
56
|
|
|
* |
57
|
|
|
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher |
58
|
|
|
*/ |
59
|
|
|
public function subscribe(Dispatcher $dispatcher) |
60
|
|
|
{ |
61
|
|
|
// Authentication events |
62
|
|
|
$dispatcher->listen('rinvex.fort.auth.user', __CLASS__.'@authUser'); |
63
|
|
|
$dispatcher->listen('rinvex.fort.auth.login', __CLASS__.'@authLogin'); |
64
|
|
|
$dispatcher->listen('rinvex.fort.auth.failed', __CLASS__.'@authFailed'); |
65
|
|
|
$dispatcher->listen('rinvex.fort.auth.lockout', __CLASS__.'@authLockout'); |
66
|
|
|
$dispatcher->listen('rinvex.fort.auth.unverified', __CLASS__.'@authUnverified'); |
67
|
|
|
$dispatcher->listen('rinvex.fort.auth.autologout', __CLASS__.'@authAutoLogout'); |
68
|
|
|
$dispatcher->listen('rinvex.fort.auth.attempt', __CLASS__.'@authAttempt'); |
69
|
|
|
$dispatcher->listen('rinvex.fort.auth.logout', __CLASS__.'@authLogout'); |
70
|
|
|
$dispatcher->listen('rinvex.fort.auth.valid', __CLASS__.'@authValid'); |
71
|
|
|
|
72
|
|
|
// Two-Factor required events |
73
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.required', __CLASS__.'@twoFactorRequired'); |
74
|
|
|
|
75
|
|
|
// Two-Factor backup verify events |
76
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.backup.verify.start', __CLASS__.'@twoFactorBackupVerifyStart'); |
77
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.backup.verify.failed', __CLASS__.'@twoFactorBackupVerifyFailed'); |
78
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.backup.verify.success', __CLASS__.'@twoFactorBackupVerifySuccess'); |
79
|
|
|
|
80
|
|
|
// Two-Factor phone register events |
81
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.register.start', __CLASS__.'@twoFactorPhoneRegisterStart'); |
82
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.register.failed', __CLASS__.'@twoFactorPhoneRegisterFailed'); |
83
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.register.success', __CLASS__.'@twoFactorPhoneRegisterSuccess'); |
84
|
|
|
|
85
|
|
|
// Two-Factor phone verify events |
86
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.verify.start', __CLASS__.'@twoFactorPhoneVerifyStart'); |
87
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.verify.failed', __CLASS__.'@twoFactorPhoneVerifyFailed'); |
88
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.verify.success', __CLASS__.'@twoFactorPhoneVerifySuccess'); |
89
|
|
|
|
90
|
|
|
// Two-Factor phone delete events |
91
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.delete.start', __CLASS__.'@twoFactorPhoneDeleteStart'); |
92
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.delete.failed', __CLASS__.'@twoFactorPhoneDeleteFailed'); |
93
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.phone.delete.success', __CLASS__.'@twoFactorPhoneDeleteSuccess'); |
94
|
|
|
|
95
|
|
|
// Two-Factor TOTP verify events |
96
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.totp.verify.start', __CLASS__.'@twoFactorTotpVerifyStart'); |
97
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.totp.verify.failed', __CLASS__.'@twoFactorTotpVerifyFailed'); |
98
|
|
|
$dispatcher->listen('rinvex.fort.twofactor.totp.verify.success', __CLASS__.'@twoFactorTotpVerifySuccess'); |
99
|
|
|
|
100
|
|
|
// Registration events |
101
|
|
|
$dispatcher->listen('rinvex.fort.register.start', __CLASS__.'@registerStart'); |
102
|
|
|
$dispatcher->listen('rinvex.fort.register.success', __CLASS__.'@registerSuccess'); |
103
|
|
|
$dispatcher->listen('rinvex.fort.register.social.start', __CLASS__.'@registerSocialStart'); |
104
|
|
|
$dispatcher->listen('rinvex.fort.register.social.success', __CLASS__.'@registerSocialSuccess'); |
105
|
|
|
|
106
|
|
|
// Reset password events |
107
|
|
|
$dispatcher->listen('rinvex.fort.passwordreset.start', __CLASS__.'@passwordResetStart'); |
108
|
|
|
$dispatcher->listen('rinvex.fort.passwordreset.success', __CLASS__.'@passwordResetSuccess'); |
109
|
|
|
|
110
|
|
|
// Email verification events |
111
|
|
|
$dispatcher->listen('rinvex.fort.emailverification.start', __CLASS__.'@emailVerificationStart'); |
112
|
|
|
$dispatcher->listen('rinvex.fort.emailverification.success', __CLASS__.'@emailVerificationSuccess'); |
113
|
|
|
|
114
|
|
|
// Ability events |
115
|
|
|
$dispatcher->listen('rinvex.fort.ability.granting', __CLASS__.'@abilityGranting'); |
116
|
|
|
$dispatcher->listen('rinvex.fort.ability.granted', __CLASS__.'@abilityGranted'); |
117
|
|
|
$dispatcher->listen('rinvex.fort.ability.revoking', __CLASS__.'@abilityRevoking'); |
118
|
|
|
$dispatcher->listen('rinvex.fort.ability.revoked', __CLASS__.'@abilityRevoked'); |
119
|
|
|
|
120
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.creating', __CLASS__.'@abilityCreating'); |
121
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.created', __CLASS__.'@abilityCreated'); |
122
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.updating', __CLASS__.'@abilityUpdating'); |
123
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.updated', __CLASS__.'@abilityUpdated'); |
124
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.deleting', __CLASS__.'@abilityDeleting'); |
125
|
|
|
$dispatcher->listen('rinvex.fort.ability.entity.deleted', __CLASS__.'@abilityDeleted'); |
126
|
|
|
|
127
|
|
|
// Roles events |
128
|
|
|
$dispatcher->listen('rinvex.fort.role.assigning', __CLASS__.'@roleAssigning'); |
129
|
|
|
$dispatcher->listen('rinvex.fort.role.assigned', __CLASS__.'@roleAssigned'); |
130
|
|
|
$dispatcher->listen('rinvex.fort.role.syncing', __CLASS__.'@roleSyncing'); |
131
|
|
|
$dispatcher->listen('rinvex.fort.role.synced', __CLASS__.'@roleSynced'); |
132
|
|
|
$dispatcher->listen('rinvex.fort.role.removing', __CLASS__.'@roleRemoving'); |
133
|
|
|
$dispatcher->listen('rinvex.fort.role.removed', __CLASS__.'@roleRemoved'); |
134
|
|
|
|
135
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.creating', __CLASS__.'@roleCreating'); |
136
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.created', __CLASS__.'@roleCreated'); |
137
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.updating', __CLASS__.'@roleUpdating'); |
138
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.updated', __CLASS__.'@roleUpdated'); |
139
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.deleting', __CLASS__.'@roleDeleting'); |
140
|
|
|
$dispatcher->listen('rinvex.fort.role.entity.deleted', __CLASS__.'@roleDeleted'); |
141
|
|
|
|
142
|
|
|
// Users events |
143
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.creating', __CLASS__.'@userCreating'); |
144
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.created', __CLASS__.'@userCreated'); |
145
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.updating', __CLASS__.'@userUpdating'); |
146
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.updated', __CLASS__.'@userUpdated'); |
147
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.deleting', __CLASS__.'@userDeleting'); |
148
|
|
|
$dispatcher->listen('rinvex.fort.user.entity.deleted', __CLASS__.'@userDeleted'); |
149
|
|
|
|
150
|
|
|
// Persistences events |
151
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.creating', __CLASS__.'@persistenceCreating'); |
152
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.created', __CLASS__.'@persistenceCreated'); |
153
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.updating', __CLASS__.'@persistenceUpdating'); |
154
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.updated', __CLASS__.'@persistenceUpdated'); |
155
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.deleting', __CLASS__.'@persistenceDeleting'); |
156
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.deleted', __CLASS__.'@persistenceDeleted'); |
157
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.deleting.all', __CLASS__.'@persistenceDeletingAll'); |
158
|
|
|
$dispatcher->listen('rinvex.fort.persistence.entity.deleted.all', __CLASS__.'@persistenceDeletedAll'); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Listen to the authentication event. |
163
|
|
|
* |
164
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
165
|
|
|
* |
166
|
|
|
* @return void |
167
|
|
|
*/ |
168
|
|
|
public function authUser(AuthenticatableContract $user) |
|
|
|
|
169
|
|
|
{ |
170
|
|
|
// |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Listen to the authentication event. |
175
|
|
|
* |
176
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
177
|
|
|
* @param bool $remember |
178
|
|
|
* |
179
|
|
|
* @return void |
180
|
|
|
*/ |
181
|
|
|
public function authLogin(AuthenticatableContract $user, $remember) |
|
|
|
|
182
|
|
|
{ |
183
|
|
|
// |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* Listen to the authentication fail event. |
188
|
|
|
* |
189
|
|
|
* @param array $credentials |
190
|
|
|
* @param bool $remember |
191
|
|
|
* |
192
|
|
|
* @return void |
193
|
|
|
*/ |
194
|
|
|
public function authFailed(array $credentials, $remember) |
|
|
|
|
195
|
|
|
{ |
196
|
|
|
// |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* Listen to the authentication lockout event. |
201
|
|
|
* |
202
|
|
|
* @param \Illuminate\Http\Request $request |
203
|
|
|
* |
204
|
|
|
* @return void |
205
|
|
|
*/ |
206
|
|
|
public function authLockout(Request $request) |
207
|
|
|
{ |
208
|
|
|
if (config('rinvex.fort.throttle.lockout_email')) { |
209
|
|
|
$user = get_login_field($loginfield = $request->get('loginfield')) == 'email' ? $this->app['rinvex.fort.user']->findBy('email', $loginfield) : $this->app['rinvex.fort.user']->findBy('username', $loginfield); |
|
|
|
|
210
|
|
|
|
211
|
|
|
$user->notify(new AuthenticationLockoutNotification($request)); |
212
|
|
|
} |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* Listen to the authentication unverified event. |
217
|
|
|
* |
218
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
219
|
|
|
* |
220
|
|
|
* @return void |
221
|
|
|
*/ |
222
|
|
|
public function authUnverified(AuthenticatableContract $user) |
|
|
|
|
223
|
|
|
{ |
224
|
|
|
// |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Listen to the automatic logout event. |
229
|
|
|
* |
230
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
231
|
|
|
* |
232
|
|
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse |
|
|
|
|
233
|
|
|
*/ |
234
|
|
|
public function authAutoLogout(AuthenticatableContract $user) |
|
|
|
|
235
|
|
|
{ |
236
|
|
|
// |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* Listen to the authentication attempt event. |
241
|
|
|
* |
242
|
|
|
* @param array $credentials |
243
|
|
|
* @param bool $remember |
244
|
|
|
* @param bool $login |
245
|
|
|
* |
246
|
|
|
* @return void |
247
|
|
|
*/ |
248
|
|
|
public function authAttempt($credentials, $remember, $login) |
|
|
|
|
249
|
|
|
{ |
250
|
|
|
// |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* Listen to the authentication logout event. |
255
|
|
|
* |
256
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
257
|
|
|
* |
258
|
|
|
* @return void |
259
|
|
|
*/ |
260
|
|
|
public function authLogout(AuthenticatableContract $user) |
|
|
|
|
261
|
|
|
{ |
262
|
|
|
// |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* Listen to the authentication valid event. |
267
|
|
|
* |
268
|
|
|
* @param array $credentials |
269
|
|
|
* @param bool $remember |
270
|
|
|
* |
271
|
|
|
* @return void |
272
|
|
|
*/ |
273
|
|
|
public function authValid(array $credentials, $remember) |
|
|
|
|
274
|
|
|
{ |
275
|
|
|
// |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* Listen to the Two-Factor required event. |
280
|
|
|
* |
281
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
282
|
|
|
* |
283
|
|
|
* @return void |
284
|
|
|
*/ |
285
|
|
|
public function twoFactorRequired(AuthenticatableContract $user) |
|
|
|
|
286
|
|
|
{ |
287
|
|
|
// |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* Listen to the Two-Factor backup verify start event. |
292
|
|
|
* |
293
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
294
|
|
|
* @param string $token |
295
|
|
|
* |
296
|
|
|
* @return void |
297
|
|
|
*/ |
298
|
|
|
public function twoFactorBackupVerifyStart(AuthenticatableContract $user, $token) |
|
|
|
|
299
|
|
|
{ |
300
|
|
|
// |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* Listen to the Two-Factor backup verify failed event. |
305
|
|
|
* |
306
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
307
|
|
|
* @param string $token |
308
|
|
|
* |
309
|
|
|
* @return void |
310
|
|
|
*/ |
311
|
|
|
public function twoFactorBackupVerifyFailed(AuthenticatableContract $user, $token) |
|
|
|
|
312
|
|
|
{ |
313
|
|
|
// |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* Listen to the Two-Factor backup verify success event. |
318
|
|
|
* |
319
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
320
|
|
|
* @param string $token |
321
|
|
|
* |
322
|
|
|
* @return void |
323
|
|
|
*/ |
324
|
|
|
public function twoFactorBackupVerifySuccess(AuthenticatableContract $user, $token) |
|
|
|
|
325
|
|
|
{ |
326
|
|
|
// |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Listen to the Two-Factor phone register start event. |
331
|
|
|
* |
332
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
333
|
|
|
* |
334
|
|
|
* @return void |
335
|
|
|
*/ |
336
|
|
|
public function twoFactorPhoneRegisterStart(AuthenticatableContract $user) |
|
|
|
|
337
|
|
|
{ |
338
|
|
|
// |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Listen to the Two-Factor phone register failed event. |
343
|
|
|
* |
344
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
345
|
|
|
* @param array $response |
346
|
|
|
* |
347
|
|
|
* @return void |
348
|
|
|
*/ |
349
|
|
|
public function twoFactorPhoneRegisterFailed(AuthenticatableContract $user, array $response) |
|
|
|
|
350
|
|
|
{ |
351
|
|
|
// |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Listen to the Two-Factor phone register success event. |
356
|
|
|
* |
357
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
358
|
|
|
* @param array $response |
359
|
|
|
* |
360
|
|
|
* @return void |
361
|
|
|
*/ |
362
|
|
|
public function twoFactorPhoneRegisterSuccess(AuthenticatableContract $user, array $response) |
|
|
|
|
363
|
|
|
{ |
364
|
|
|
// |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Listen to the Two-Factor phone verify start event. |
369
|
|
|
* |
370
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
371
|
|
|
* @param string $token |
372
|
|
|
* |
373
|
|
|
* @return void |
374
|
|
|
*/ |
375
|
|
|
public function twoFactorPhoneVerifyStart(AuthenticatableContract $user, $token) |
|
|
|
|
376
|
|
|
{ |
377
|
|
|
// |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Listen to the Two-Factor phone verify failed event. |
382
|
|
|
* |
383
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
384
|
|
|
* @param string $token |
385
|
|
|
* @param array $response |
386
|
|
|
* |
387
|
|
|
* @return void |
388
|
|
|
*/ |
389
|
|
|
public function twoFactorPhoneVerifyFailed(AuthenticatableContract $user, $token, array $response) |
|
|
|
|
390
|
|
|
{ |
391
|
|
|
// |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* Listen to the Two-Factor phone verify success event. |
396
|
|
|
* |
397
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
398
|
|
|
* @param string $token |
399
|
|
|
* @param array $response |
400
|
|
|
* |
401
|
|
|
* @return void |
402
|
|
|
*/ |
403
|
|
|
public function twoFactorPhoneVerifySuccess(AuthenticatableContract $user, $token, array $response) |
|
|
|
|
404
|
|
|
{ |
405
|
|
|
// |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Listen to the Two-Factor phone delete start event. |
410
|
|
|
* |
411
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
412
|
|
|
* |
413
|
|
|
* @return void |
414
|
|
|
*/ |
415
|
|
|
public function twoFactorPhoneDeleteStart(AuthenticatableContract $user) |
|
|
|
|
416
|
|
|
{ |
417
|
|
|
// |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* Listen to the Two-Factor phone delete failed event. |
422
|
|
|
* |
423
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
424
|
|
|
* @param array $response |
425
|
|
|
* |
426
|
|
|
* @return void |
427
|
|
|
*/ |
428
|
|
|
public function twoFactorPhoneDeleteFailed(AuthenticatableContract $user, array $response) |
|
|
|
|
429
|
|
|
{ |
430
|
|
|
// |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* Listen to the Two-Factor phone delete success event. |
435
|
|
|
* |
436
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
437
|
|
|
* @param array $response |
438
|
|
|
* |
439
|
|
|
* @return void |
440
|
|
|
*/ |
441
|
|
|
public function twoFactorPhoneDeleteSuccess(AuthenticatableContract $user, array $response) |
|
|
|
|
442
|
|
|
{ |
443
|
|
|
// |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* Listen to the Two-Factor TOTP verify start event. |
448
|
|
|
* |
449
|
|
|
* @param string $secret |
450
|
|
|
* @param string $token |
451
|
|
|
* |
452
|
|
|
* @return void |
453
|
|
|
*/ |
454
|
|
|
public function twoFactorTotpVerifyStart($secret, $token) |
|
|
|
|
455
|
|
|
{ |
456
|
|
|
// |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* Listen to the Two-Factor TOTP verify failed event. |
461
|
|
|
* |
462
|
|
|
* @param string $secret |
463
|
|
|
* @param string $token |
464
|
|
|
* |
465
|
|
|
* @return void |
466
|
|
|
*/ |
467
|
|
|
public function twoFactorTotpVerifyFailed($secret, $token) |
|
|
|
|
468
|
|
|
{ |
469
|
|
|
// |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* Listen to the Two-Factor TOTP verify success event. |
474
|
|
|
* |
475
|
|
|
* @param string $secret |
476
|
|
|
* @param string $token |
477
|
|
|
* |
478
|
|
|
* @return void |
479
|
|
|
*/ |
480
|
|
|
public function twoFactorTotpVerifySuccess($secret, $token) |
|
|
|
|
481
|
|
|
{ |
482
|
|
|
// |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* Listen to the register start event. |
487
|
|
|
* |
488
|
|
|
* @param array $credentials |
489
|
|
|
* |
490
|
|
|
* @return void |
491
|
|
|
*/ |
492
|
|
|
public function registerStart(array $credentials) |
|
|
|
|
493
|
|
|
{ |
494
|
|
|
// |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* Listen to the register success event. |
499
|
|
|
* |
500
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
501
|
|
|
* |
502
|
|
|
* @return void |
503
|
|
|
*/ |
504
|
|
|
public function registerSuccess(AuthenticatableContract $user) |
505
|
|
|
{ |
506
|
|
|
// Send welcome email |
507
|
|
|
if (config('rinvex.fort.registration.welcome_email')) { |
508
|
|
|
$user->notify(new RegistrationSuccessNotification()); |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
// Attach default role to the registered user |
512
|
|
|
if ($default = $this->app['config']->get('rinvex.fort.registration.default_role')) { |
513
|
|
|
if ($role = $this->app['rinvex.fort.role']->findBy('slug', $default)) { |
514
|
|
|
$user->roles()->attach($role); |
515
|
|
|
} |
516
|
|
|
} |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* Listen to the register social start event. |
521
|
|
|
* |
522
|
|
|
* @param array $credentials |
523
|
|
|
* |
524
|
|
|
* @return void |
525
|
|
|
*/ |
526
|
|
|
public function registerSocialStart(array $credentials) |
|
|
|
|
527
|
|
|
{ |
528
|
|
|
// |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* Listen to the register social success event. |
533
|
|
|
* |
534
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
535
|
|
|
* |
536
|
|
|
* @return void |
537
|
|
|
*/ |
538
|
|
|
public function registerSocialSuccess(AuthenticatableContract $user) |
539
|
|
|
{ |
540
|
|
|
// Send welcome email |
541
|
|
|
if (config('rinvex.fort.registration.welcome_email')) { |
542
|
|
|
$user->notify(new RegistrationSuccessNotification(true)); |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
// Attach default role to the registered user |
546
|
|
|
if ($default = $this->app['config']->get('rinvex.fort.registration.default_role')) { |
547
|
|
|
if ($role = $this->app['rinvex.fort.role']->findBy('slug', $default)) { |
548
|
|
|
$user->roles()->attach($role); |
549
|
|
|
} |
550
|
|
|
} |
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* Listen to the password reset start event. |
555
|
|
|
* |
556
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
557
|
|
|
* |
558
|
|
|
* @return void |
559
|
|
|
*/ |
560
|
|
|
public function passwordResetStart(AuthenticatableContract $user) |
|
|
|
|
561
|
|
|
{ |
562
|
|
|
// |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* Listen to the password reset success event. |
567
|
|
|
* |
568
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
569
|
|
|
* |
570
|
|
|
* @return void |
571
|
|
|
*/ |
572
|
|
|
public function passwordResetSuccess(AuthenticatableContract $user) |
|
|
|
|
573
|
|
|
{ |
574
|
|
|
// |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* Listen to the email verification start. |
579
|
|
|
* |
580
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
581
|
|
|
* |
582
|
|
|
* @return void |
583
|
|
|
*/ |
584
|
|
|
public function emailVerificationStart(AuthenticatableContract $user) |
|
|
|
|
585
|
|
|
{ |
586
|
|
|
// |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
/** |
590
|
|
|
* Listen to the email verification success. |
591
|
|
|
* |
592
|
|
|
* @param \Rinvex\Fort\Contracts\AuthenticatableContract $user |
593
|
|
|
* |
594
|
|
|
* @return void |
595
|
|
|
*/ |
596
|
|
|
public function emailVerificationSuccess(AuthenticatableContract $user) |
597
|
|
|
{ |
598
|
|
|
if (config('rinvex.fort.emailverification.success_notification')) { |
599
|
|
|
$user->notify(new VerificationSuccessNotification($user->active)); |
|
|
|
|
600
|
|
|
} |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* Listen to the ability granting. |
605
|
|
|
* |
606
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
607
|
|
|
* @param string|array $action |
608
|
|
|
* @param string|array $resource |
609
|
|
|
* |
610
|
|
|
* @return void |
611
|
|
|
*/ |
612
|
|
|
public function abilityGranting(Model $model, $action, $resource) |
|
|
|
|
613
|
|
|
{ |
614
|
|
|
// |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
/** |
618
|
|
|
* Listen to the ability granted. |
619
|
|
|
* |
620
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
621
|
|
|
* @param string|array $action |
622
|
|
|
* @param string|array $resource |
623
|
|
|
* |
624
|
|
|
* @return void |
625
|
|
|
*/ |
626
|
|
|
public function abilityGranted(Model $model, $action, $resource) |
|
|
|
|
627
|
|
|
{ |
628
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
629
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
630
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
631
|
|
|
} |
632
|
|
|
|
633
|
|
|
/** |
634
|
|
|
* Listen to the ability revoking. |
635
|
|
|
* |
636
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
637
|
|
|
* @param string|array $action |
638
|
|
|
* @param string|array $resource |
639
|
|
|
* |
640
|
|
|
* @return void |
641
|
|
|
*/ |
642
|
|
|
public function abilityRevoking(Model $model, $action, $resource) |
|
|
|
|
643
|
|
|
{ |
644
|
|
|
// |
645
|
|
|
} |
646
|
|
|
|
647
|
|
|
/** |
648
|
|
|
* Listen to the ability revoked. |
649
|
|
|
* |
650
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
651
|
|
|
* @param string|array $action |
652
|
|
|
* @param string|array $resource |
653
|
|
|
* |
654
|
|
|
* @return void |
655
|
|
|
*/ |
656
|
|
|
public function abilityRevoked(Model $model, $action, $resource) |
|
|
|
|
657
|
|
|
{ |
658
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
659
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
660
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
661
|
|
|
} |
662
|
|
|
|
663
|
|
|
/** |
664
|
|
|
* Listen to the ability being created. |
665
|
|
|
* |
666
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
667
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
668
|
|
|
* |
669
|
|
|
* @return void |
670
|
|
|
*/ |
671
|
|
|
public function abilityCreating(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
672
|
|
|
{ |
673
|
|
|
// |
674
|
|
|
} |
675
|
|
|
|
676
|
|
|
/** |
677
|
|
|
* Listen to the ability created. |
678
|
|
|
* |
679
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
680
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
681
|
|
|
* |
682
|
|
|
* @return void |
683
|
|
|
*/ |
684
|
|
|
public function abilityCreated(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
685
|
|
|
{ |
686
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
687
|
|
|
} |
688
|
|
|
|
689
|
|
|
/** |
690
|
|
|
* Listen to the ability being updated. |
691
|
|
|
* |
692
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
693
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
694
|
|
|
* |
695
|
|
|
* @return void |
696
|
|
|
*/ |
697
|
|
|
public function abilityUpdating(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
698
|
|
|
{ |
699
|
|
|
// |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
/** |
703
|
|
|
* Listen to the ability updated. |
704
|
|
|
* |
705
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
706
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
707
|
|
|
* |
708
|
|
|
* @return void |
709
|
|
|
*/ |
710
|
|
|
public function abilityUpdated(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
711
|
|
|
{ |
712
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
713
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
714
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
715
|
|
|
} |
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* Listen to the ability being deleted. |
719
|
|
|
* |
720
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
721
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
722
|
|
|
* |
723
|
|
|
* @return void |
724
|
|
|
*/ |
725
|
|
|
public function abilityDeleting(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
726
|
|
|
{ |
727
|
|
|
// |
728
|
|
|
} |
729
|
|
|
|
730
|
|
|
/** |
731
|
|
|
* Listen to the ability deleted. |
732
|
|
|
* |
733
|
|
|
* @param \Rinvex\Fort\Contracts\AbilityRepositoryContract $repository |
734
|
|
|
* @param \Rinvex\Fort\Models\Ability $ability |
735
|
|
|
* |
736
|
|
|
* @return void |
737
|
|
|
*/ |
738
|
|
|
public function abilityDeleted(AbilityRepositoryContract $repository, Ability $ability) |
|
|
|
|
739
|
|
|
{ |
740
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
741
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
742
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* Listen to the role assigning. |
747
|
|
|
* |
748
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
749
|
|
|
* @param mixed $role |
750
|
|
|
* |
751
|
|
|
* @return void |
752
|
|
|
*/ |
753
|
|
|
public function roleAssigning(Model $model, $role) |
|
|
|
|
754
|
|
|
{ |
755
|
|
|
// |
756
|
|
|
} |
757
|
|
|
|
758
|
|
|
/** |
759
|
|
|
* Listen to the role assigned. |
760
|
|
|
* |
761
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
762
|
|
|
* @param mixed $role |
763
|
|
|
* |
764
|
|
|
* @return void |
765
|
|
|
*/ |
766
|
|
|
public function roleAssigned(Model $model, $role) |
|
|
|
|
767
|
|
|
{ |
768
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
769
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
/** |
773
|
|
|
* Listen to the role syncing. |
774
|
|
|
* |
775
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
776
|
|
|
* @param mixed $role |
777
|
|
|
* |
778
|
|
|
* @return void |
779
|
|
|
*/ |
780
|
|
|
public function roleSyncing(Model $model, $role) |
|
|
|
|
781
|
|
|
{ |
782
|
|
|
// |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* Listen to the role synced. |
787
|
|
|
* |
788
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
789
|
|
|
* @param mixed $role |
790
|
|
|
* |
791
|
|
|
* @return void |
792
|
|
|
*/ |
793
|
|
|
public function roleSynced(Model $model, $role) |
|
|
|
|
794
|
|
|
{ |
795
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
796
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
797
|
|
|
} |
798
|
|
|
|
799
|
|
|
/** |
800
|
|
|
* Listen to the role removing. |
801
|
|
|
* |
802
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
803
|
|
|
* @param mixed $role |
804
|
|
|
* |
805
|
|
|
* @return void |
806
|
|
|
*/ |
807
|
|
|
public function roleRemoving(Model $model, $role) |
|
|
|
|
808
|
|
|
{ |
809
|
|
|
// |
810
|
|
|
} |
811
|
|
|
|
812
|
|
|
/** |
813
|
|
|
* Listen to the role removed. |
814
|
|
|
* |
815
|
|
|
* @param \Illuminate\Database\Eloquent\Model $model |
816
|
|
|
* @param mixed $role |
817
|
|
|
* |
818
|
|
|
* @return void |
819
|
|
|
*/ |
820
|
|
|
public function roleRemoved(Model $model, $role) |
|
|
|
|
821
|
|
|
{ |
822
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
823
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
824
|
|
|
} |
825
|
|
|
|
826
|
|
|
/** |
827
|
|
|
* Listen to the role being created. |
828
|
|
|
* |
829
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
830
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
831
|
|
|
* |
832
|
|
|
* @return void |
833
|
|
|
*/ |
834
|
|
|
public function roleCreating(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
835
|
|
|
{ |
836
|
|
|
// |
837
|
|
|
} |
838
|
|
|
|
839
|
|
|
/** |
840
|
|
|
* Listen to the role created. |
841
|
|
|
* |
842
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
843
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
844
|
|
|
* |
845
|
|
|
* @return void |
846
|
|
|
*/ |
847
|
|
|
public function roleCreated(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
848
|
|
|
{ |
849
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
850
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
851
|
|
|
} |
852
|
|
|
|
853
|
|
|
/** |
854
|
|
|
* Listen to the role being updated. |
855
|
|
|
* |
856
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
857
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
858
|
|
|
* |
859
|
|
|
* @return void |
860
|
|
|
*/ |
861
|
|
|
public function roleUpdating(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
862
|
|
|
{ |
863
|
|
|
// |
864
|
|
|
} |
865
|
|
|
|
866
|
|
|
/** |
867
|
|
|
* Listen to the role updated. |
868
|
|
|
* |
869
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
870
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
871
|
|
|
* |
872
|
|
|
* @return void |
873
|
|
|
*/ |
874
|
|
|
public function roleUpdated(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
875
|
|
|
{ |
876
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
877
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
878
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
879
|
|
|
} |
880
|
|
|
|
881
|
|
|
/** |
882
|
|
|
* Listen to the role being deleted. |
883
|
|
|
* |
884
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
885
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
886
|
|
|
* |
887
|
|
|
* @return void |
888
|
|
|
*/ |
889
|
|
|
public function roleDeleting(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
890
|
|
|
{ |
891
|
|
|
// |
892
|
|
|
} |
893
|
|
|
|
894
|
|
|
/** |
895
|
|
|
* Listen to the role deleted. |
896
|
|
|
* |
897
|
|
|
* @param \Rinvex\Fort\Contracts\RoleRepositoryContract $repository |
898
|
|
|
* @param \Rinvex\Fort\Models\Role $model |
899
|
|
|
* |
900
|
|
|
* @return void |
901
|
|
|
*/ |
902
|
|
|
public function roleDeleted(RoleRepositoryContract $repository, Role $model) |
|
|
|
|
903
|
|
|
{ |
904
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
905
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
906
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
907
|
|
|
} |
908
|
|
|
|
909
|
|
|
/** |
910
|
|
|
* Listen to the user being created. |
911
|
|
|
* |
912
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
913
|
|
|
* @param \Rinvex\Fort\Models\User $model |
914
|
|
|
* |
915
|
|
|
* @return void |
916
|
|
|
*/ |
917
|
|
|
public function userCreating(UserRepositoryContract $repository, User $model) |
|
|
|
|
918
|
|
|
{ |
919
|
|
|
// |
920
|
|
|
} |
921
|
|
|
|
922
|
|
|
/** |
923
|
|
|
* Listen to the user created. |
924
|
|
|
* |
925
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
926
|
|
|
* @param \Rinvex\Fort\Models\User $model |
927
|
|
|
* |
928
|
|
|
* @return void |
929
|
|
|
*/ |
930
|
|
|
public function userCreated(UserRepositoryContract $repository, User $model) |
|
|
|
|
931
|
|
|
{ |
932
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
933
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
934
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
935
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
936
|
|
|
} |
937
|
|
|
|
938
|
|
|
/** |
939
|
|
|
* Listen to the user being updated. |
940
|
|
|
* |
941
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
942
|
|
|
* @param \Rinvex\Fort\Models\User $model |
943
|
|
|
* |
944
|
|
|
* @return void |
945
|
|
|
*/ |
946
|
|
|
public function userUpdating(UserRepositoryContract $repository, User $model) |
|
|
|
|
947
|
|
|
{ |
948
|
|
|
// |
949
|
|
|
} |
950
|
|
|
|
951
|
|
|
/** |
952
|
|
|
* Listen to the user updated. |
953
|
|
|
* |
954
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
955
|
|
|
* @param \Rinvex\Fort\Models\User $model |
956
|
|
|
* |
957
|
|
|
* @return void |
958
|
|
|
*/ |
959
|
|
|
public function userUpdated(UserRepositoryContract $repository, User $model) |
|
|
|
|
960
|
|
|
{ |
961
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
962
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
963
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
964
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
965
|
|
|
} |
966
|
|
|
|
967
|
|
|
/** |
968
|
|
|
* Listen to the user being deleted. |
969
|
|
|
* |
970
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
971
|
|
|
* @param \Rinvex\Fort\Models\User $model |
972
|
|
|
* |
973
|
|
|
* @return void |
974
|
|
|
*/ |
975
|
|
|
public function userDeleting(UserRepositoryContract $repository, User $model) |
|
|
|
|
976
|
|
|
{ |
977
|
|
|
// |
978
|
|
|
} |
979
|
|
|
|
980
|
|
|
/** |
981
|
|
|
* Listen to the user deleted. |
982
|
|
|
* |
983
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
984
|
|
|
* @param \Rinvex\Fort\Models\User $model |
985
|
|
|
* |
986
|
|
|
* @return void |
987
|
|
|
*/ |
988
|
|
|
public function userDeleted(UserRepositoryContract $repository, User $model) |
|
|
|
|
989
|
|
|
{ |
990
|
|
|
$this->app['rinvex.fort.ability']->forgetCache(); |
991
|
|
|
$this->app['rinvex.fort.role']->forgetCache(); |
992
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
993
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
994
|
|
|
} |
995
|
|
|
|
996
|
|
|
/** |
997
|
|
|
* Listen to the persistence being created. |
998
|
|
|
* |
999
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1000
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1001
|
|
|
* |
1002
|
|
|
* @return void |
1003
|
|
|
*/ |
1004
|
|
|
public function persistenceCreating(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1005
|
|
|
{ |
1006
|
|
|
// |
1007
|
|
|
} |
1008
|
|
|
|
1009
|
|
|
/** |
1010
|
|
|
* Listen to the persistence created. |
1011
|
|
|
* |
1012
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1013
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1014
|
|
|
* |
1015
|
|
|
* @return void |
1016
|
|
|
*/ |
1017
|
|
|
public function persistenceCreated(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1018
|
|
|
{ |
1019
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
1020
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
1021
|
|
|
} |
1022
|
|
|
|
1023
|
|
|
/** |
1024
|
|
|
* Listen to the persistence being updated. |
1025
|
|
|
* |
1026
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1027
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1028
|
|
|
* |
1029
|
|
|
* @return void |
1030
|
|
|
*/ |
1031
|
|
|
public function persistenceUpdating(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1032
|
|
|
{ |
1033
|
|
|
// |
1034
|
|
|
} |
1035
|
|
|
|
1036
|
|
|
/** |
1037
|
|
|
* Listen to the persistence updated. |
1038
|
|
|
* |
1039
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1040
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1041
|
|
|
* |
1042
|
|
|
* @return void |
1043
|
|
|
*/ |
1044
|
|
|
public function persistenceUpdated(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1045
|
|
|
{ |
1046
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
1047
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
1048
|
|
|
} |
1049
|
|
|
|
1050
|
|
|
/** |
1051
|
|
|
* Listen to the persistence being deleted. |
1052
|
|
|
* |
1053
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1054
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1055
|
|
|
* |
1056
|
|
|
* @return void |
1057
|
|
|
*/ |
1058
|
|
|
public function persistenceDeleting(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1059
|
|
|
{ |
1060
|
|
|
// |
1061
|
|
|
} |
1062
|
|
|
|
1063
|
|
|
/** |
1064
|
|
|
* Listen to the persistence deleted. |
1065
|
|
|
* |
1066
|
|
|
* @param \Rinvex\Fort\Contracts\PersistenceRepositoryContract $repository |
1067
|
|
|
* @param \Rinvex\Fort\Models\Persistence $model |
1068
|
|
|
* |
1069
|
|
|
* @return void |
1070
|
|
|
*/ |
1071
|
|
|
public function persistenceDeleted(PersistenceRepositoryContract $repository, Persistence $model) |
|
|
|
|
1072
|
|
|
{ |
1073
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
1074
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
1075
|
|
|
} |
1076
|
|
|
|
1077
|
|
|
/** |
1078
|
|
|
* Listen to the all persistence being deleted. |
1079
|
|
|
* |
1080
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
|
|
|
|
1081
|
|
|
* @param \Rinvex\Fort\Models\User $model |
1082
|
|
|
* |
1083
|
|
|
* @return void |
1084
|
|
|
*/ |
1085
|
|
|
public function persistenceDeletingAll(PersistenceRepositoryContract $repository, User $model) |
|
|
|
|
1086
|
|
|
{ |
1087
|
|
|
// |
1088
|
|
|
} |
1089
|
|
|
|
1090
|
|
|
/** |
1091
|
|
|
* Listen to the all persistence deleted. |
1092
|
|
|
* |
1093
|
|
|
* @param \Rinvex\Fort\Contracts\UserRepositoryContract $repository |
|
|
|
|
1094
|
|
|
* @param \Rinvex\Fort\Models\User $model |
1095
|
|
|
* |
1096
|
|
|
* @return void |
1097
|
|
|
*/ |
1098
|
|
|
public function persistenceDeletedAll(PersistenceRepositoryContract $repository, User $model) |
|
|
|
|
1099
|
|
|
{ |
1100
|
|
|
$this->app['rinvex.fort.persistence']->forgetCache(); |
1101
|
|
|
$this->app['rinvex.fort.user']->forgetCache(); |
1102
|
|
|
} |
1103
|
|
|
} |
1104
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.