1 | <?php namespace Arcanesoft\Auth\Models; |
||
15 | class User extends BaseUserModel implements Impersonatable |
||
|
|||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Traits |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | use Presenters\UserPresenter, |
||
23 | CanImpersonate; |
||
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Relationships |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | /** |
||
31 | * Password reset relationship. |
||
32 | * |
||
33 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
34 | */ |
||
35 | public function passwordReset() |
||
39 | |||
40 | /* ----------------------------------------------------------------- |
||
41 | | Main Methods |
||
42 | | ----------------------------------------------------------------- |
||
43 | */ |
||
44 | |||
45 | /** |
||
46 | * Get a user from a hashed id or fail if not found. |
||
47 | * |
||
48 | * @param string $hashedId |
||
49 | * |
||
50 | * @return self |
||
51 | * |
||
52 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
53 | */ |
||
54 | public static function firstHashedOrFail($hashedId) |
||
58 | |||
59 | /* ----------------------------------------------------------------- |
||
60 | | Check Methods |
||
61 | | ----------------------------------------------------------------- |
||
62 | */ |
||
63 | |||
64 | /** |
||
65 | * Check if user is an administrator. |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function isAdmin() |
||
73 | |||
74 | /** |
||
75 | * Check if user is a moderator. |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | public function isModerator() |
||
83 | |||
84 | /** |
||
85 | * Check if user is a member. |
||
86 | * |
||
87 | * @return bool |
||
88 | */ |
||
89 | public function isMember() |
||
93 | |||
94 | /** |
||
95 | * Check if user has a password reset. |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | public function hasPasswordReset() |
||
103 | |||
104 | /** |
||
105 | * Check if the current modal can impersonate other models. |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | public function canImpersonate() |
||
113 | |||
114 | /** |
||
115 | * Check if the current model can be impersonated. |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | public function canBeImpersonated() |
||
123 | } |
||
124 |