1 | <?php |
||
22 | class User extends Model implements |
||
23 | AuthenticatableContract, |
||
24 | AuthorizableContract, |
||
25 | CanResetPasswordContract, |
||
26 | HasRoleAndPermissionContract, |
||
27 | HasMediaConversions |
||
28 | { |
||
29 | use Authenticatable, |
||
30 | Authorizable, |
||
31 | CanResetPassword, |
||
32 | Notifiable, |
||
33 | Sluggable, |
||
34 | HasRoleAndPermission, |
||
35 | HasMediaTrait, |
||
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 | 'github_id', |
||
49 | 'register_ip', |
||
50 | 'last_login_ip', |
||
51 | 'last_login' |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * The attributes that should be hidden for arrays. |
||
56 | * |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $hidden = [ |
||
60 | 'password', |
||
61 | 'remember_token' |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * The accessors to append to the model's array form. |
||
66 | * |
||
67 | * @var array |
||
68 | */ |
||
69 | protected $appends = [ |
||
70 | 'profile_background', |
||
71 | 'profile_url', |
||
72 | |||
73 | // Media Model |
||
74 | 'avatar_small', |
||
75 | 'avatar_medium', |
||
76 | 'avatar_big', |
||
77 | 'avatar_primary_color', |
||
78 | |||
79 | // Account Model |
||
80 | 'first_name', |
||
81 | 'last_name', |
||
82 | 'full_name', |
||
83 | 'biography', |
||
84 | 'signature', |
||
85 | 'facebook', |
||
86 | 'twitter' |
||
87 | ]; |
||
88 | |||
89 | /** |
||
90 | * The attributes that should be mutated to dates. |
||
91 | * |
||
92 | * @var array |
||
93 | */ |
||
94 | protected $dates = [ |
||
95 | 'last_login' |
||
96 | ]; |
||
97 | |||
98 | /** |
||
99 | * The "booting" method of the model. |
||
100 | * |
||
101 | * @return void |
||
102 | */ |
||
103 | protected static function boot() |
||
126 | |||
127 | /** |
||
128 | * Return the field to slug. |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function slugStrategy(): string |
||
136 | |||
137 | /** |
||
138 | * Register the related to the Model. |
||
139 | * |
||
140 | * @return void |
||
141 | */ |
||
142 | public function registerMediaConversions(Media $media = null) |
||
162 | |||
163 | /** |
||
164 | * Get the comments for the user. |
||
165 | * |
||
166 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
167 | */ |
||
168 | public function comments() |
||
172 | |||
173 | /** |
||
174 | * Get the articles for the user. |
||
175 | * |
||
176 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
177 | */ |
||
178 | public function articles() |
||
182 | |||
183 | /** |
||
184 | * Get the account for the user. |
||
185 | * |
||
186 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
187 | */ |
||
188 | public function account() |
||
192 | |||
193 | /** |
||
194 | * Get the roles for the user. |
||
195 | * |
||
196 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
197 | */ |
||
198 | public function roles() |
||
202 | |||
203 | /** |
||
204 | * Get the badges for the user. |
||
205 | * |
||
206 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
207 | */ |
||
208 | public function badges() |
||
212 | |||
213 | /** |
||
214 | * Get the notifications for the user. |
||
215 | * |
||
216 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
217 | */ |
||
218 | public function notifications() |
||
224 | |||
225 | /** |
||
226 | * Get the discuss posts for the user. |
||
227 | * |
||
228 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
229 | */ |
||
230 | public function discussPosts() |
||
234 | |||
235 | /** |
||
236 | * Get the discuss conversations for the user. |
||
237 | * |
||
238 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
239 | */ |
||
240 | public function discussConversations() |
||
244 | |||
245 | /** |
||
246 | * Get the discuss users for the user. |
||
247 | * |
||
248 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
249 | */ |
||
250 | public function discussUsers() |
||
254 | |||
255 | /** |
||
256 | * Get the discuss logs for the user. |
||
257 | * |
||
258 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
259 | */ |
||
260 | public function discussLogs() |
||
264 | |||
265 | /** |
||
266 | * Get the rubies for the user. |
||
267 | * |
||
268 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
269 | */ |
||
270 | public function rubies() |
||
274 | |||
275 | /** |
||
276 | * Get the experiences for the user. |
||
277 | * |
||
278 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
279 | */ |
||
280 | public function experiences() |
||
284 | |||
285 | /** |
||
286 | * Send the password reset notification. |
||
287 | * |
||
288 | * @param string $token |
||
289 | * |
||
290 | * @return void |
||
291 | */ |
||
292 | public function sendPasswordResetNotification($token) |
||
296 | |||
297 | /** |
||
298 | * Get all permissions from roles. |
||
299 | * |
||
300 | * @return \Illuminate\Database\Eloquent\Builder |
||
301 | */ |
||
302 | public function rolePermissions(): Builder |
||
329 | } |
||
330 |