1 | <?php namespace Arcanedev\LaravelImpersonator\Traits; |
||
11 | trait CanImpersonate |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Main Methods |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** |
||
19 | * Impersonate the given user. |
||
20 | * |
||
21 | * @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonated |
||
22 | * |
||
23 | * @return bool |
||
24 | */ |
||
25 | 9 | public function impersonate(Impersonatable $impersonated) |
|
30 | |||
31 | /** |
||
32 | * Stop the impersonation. |
||
33 | * |
||
34 | * @return bool |
||
35 | */ |
||
36 | 9 | public function stopImpersonation() |
|
40 | |||
41 | /* ----------------------------------------------------------------- |
||
42 | | Check Methods |
||
43 | | ----------------------------------------------------------------- |
||
44 | */ |
||
45 | |||
46 | /** |
||
47 | * Check if the current modal can impersonate other models. |
||
48 | * |
||
49 | * @return bool |
||
50 | */ |
||
51 | abstract public function canImpersonate(); |
||
52 | |||
53 | /** |
||
54 | * Check if the current model can be impersonated. |
||
55 | * |
||
56 | * @return bool |
||
57 | */ |
||
58 | abstract public function canBeImpersonated(); |
||
59 | |||
60 | /** |
||
61 | * Check if impersonation is ongoing. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 9 | public function isImpersonated() |
|
69 | } |
||
70 |