1 | <?php |
||
21 | class User extends Model implements |
||
22 | AuthenticatableContract, |
||
23 | AuthorizableContract, |
||
24 | CanResetPasswordContract, |
||
25 | HasRoleAndPermissionContract, |
||
26 | HasMediaConversions |
||
27 | { |
||
28 | use Authenticatable, |
||
29 | Authorizable, |
||
30 | CanResetPassword, |
||
31 | Notifiable, |
||
32 | Sluggable, |
||
33 | HasRoleAndPermission, |
||
34 | HasMediaTrait, |
||
35 | UserEntity, |
||
36 | UserPresenter; |
||
37 | |||
38 | /** |
||
39 | * The attributes that are mass assignable. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $fillable = [ |
||
44 | 'username', |
||
45 | 'email', |
||
46 | 'password', |
||
47 | 'slug', |
||
48 | 'register_ip', |
||
49 | 'last_login_ip', |
||
50 | 'last_login' |
||
51 | ]; |
||
52 | |||
53 | /** |
||
54 | * The attributes that should be hidden for arrays. |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $hidden = [ |
||
59 | 'password', |
||
60 | 'remember_token' |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * The accessors to append to the model's array form. |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $appends = [ |
||
69 | 'profile_background', |
||
70 | |||
71 | // Media Model |
||
72 | 'avatar_small', |
||
73 | 'avatar_medium', |
||
74 | 'avatar_big', |
||
75 | |||
76 | // Account Model |
||
77 | 'first_name', |
||
78 | 'last_name', |
||
79 | 'biography', |
||
80 | 'signature', |
||
81 | 'facebook', |
||
82 | 'twitter' |
||
83 | ]; |
||
84 | |||
85 | /** |
||
86 | * The "booting" method of the model. |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | protected static function boot() |
||
99 | |||
100 | /** |
||
101 | * Return the field to slug. |
||
102 | * |
||
103 | * @return string |
||
104 | */ |
||
105 | public function slugStrategy(): string |
||
109 | |||
110 | /** |
||
111 | * Register the related to the Model. |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | public function registerMediaConversions() |
||
135 | |||
136 | /** |
||
137 | * Get the comments for the user. |
||
138 | * |
||
139 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
140 | */ |
||
141 | public function comments() |
||
145 | |||
146 | /** |
||
147 | * Get the articles for the user. |
||
148 | * |
||
149 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
150 | */ |
||
151 | public function articles() |
||
155 | |||
156 | /** |
||
157 | * Get the account for the user. |
||
158 | * |
||
159 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
160 | */ |
||
161 | public function account() |
||
165 | |||
166 | /** |
||
167 | * Get the roles for the user. |
||
168 | * |
||
169 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
170 | */ |
||
171 | public function roles() |
||
175 | |||
176 | /** |
||
177 | * Get the badges for the user. |
||
178 | * |
||
179 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
180 | */ |
||
181 | public function badges() |
||
185 | |||
186 | /** |
||
187 | * Get the notifications for the user. |
||
188 | * |
||
189 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
190 | */ |
||
191 | public function notifications() |
||
197 | |||
198 | /** |
||
199 | * Send the password reset notification. |
||
200 | * |
||
201 | * @param string $token |
||
202 | * |
||
203 | * @return void |
||
204 | */ |
||
205 | public function sendPasswordResetNotification($token) |
||
209 | |||
210 | /** |
||
211 | * Get all permissions from roles. |
||
212 | * |
||
213 | * @return Builder |
||
214 | */ |
||
215 | public function rolePermissions() |
||
242 | } |
||
243 |