1 | <?php |
||
8 | trait Impersonate |
||
9 | { |
||
10 | /** |
||
11 | * Return true or false if the user can impersonate an other user. |
||
12 | * |
||
13 | * @param void |
||
14 | * @return bool |
||
15 | */ |
||
16 | public function canImpersonate() |
||
20 | |||
21 | /** |
||
22 | * Return true or false if the user can be impersonate. |
||
23 | * |
||
24 | * @param void |
||
25 | * @return bool |
||
26 | */ |
||
27 | public function canBeImpersonated() |
||
31 | |||
32 | /** |
||
33 | * Impersonate the given user. |
||
34 | * |
||
35 | * @param Model $user |
||
36 | * @param string|null $guardName |
||
37 | * @return bool |
||
38 | */ |
||
39 | public function impersonate(Model $user, $guardName = null) |
||
43 | |||
44 | /** |
||
45 | * Check if the current user is impersonated. |
||
46 | * |
||
47 | * @param void |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function isImpersonated() |
||
54 | |||
55 | /** |
||
56 | * Leave the current impersonation. |
||
57 | * |
||
58 | * @param void |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function leaveImpersonation() |
||
67 | } |
||
68 |