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