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 | SoftDeletes, |
||
33 | Sluggable, |
||
34 | HasRoleAndPermission, |
||
35 | HasMediaTrait, |
||
36 | UserEntity, |
||
37 | UserPresenter; |
||
38 | |||
39 | /** |
||
40 | * The attributes that are mass assignable. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $fillable = [ |
||
45 | 'username', |
||
46 | 'email', |
||
47 | 'password', |
||
48 | 'slug', |
||
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 | |||
72 | // Media Model |
||
73 | 'avatar_small', |
||
74 | 'avatar_medium', |
||
75 | 'avatar_big', |
||
76 | |||
77 | // Account Model |
||
78 | 'first_name', |
||
79 | 'last_name', |
||
80 | 'biography', |
||
81 | 'signature', |
||
82 | 'facebook', |
||
83 | 'twitter' |
||
84 | ]; |
||
85 | |||
86 | /** |
||
87 | * The attributes that should be mutated to dates. |
||
88 | * |
||
89 | * @var array |
||
90 | */ |
||
91 | protected $dates = [ |
||
92 | 'deleted_at' |
||
93 | ]; |
||
94 | |||
95 | /** |
||
96 | * Return the field to slug. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | public function slugStrategy(): string |
||
104 | |||
105 | /** |
||
106 | * Register the related to the Model. |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | public function registerMediaConversions() |
||
130 | |||
131 | /** |
||
132 | * Get the comments for the user. |
||
133 | * |
||
134 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
135 | */ |
||
136 | public function comments() |
||
140 | |||
141 | /** |
||
142 | * Get the articles for the user. |
||
143 | * |
||
144 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
145 | */ |
||
146 | public function articles() |
||
150 | |||
151 | /** |
||
152 | * Get the account for the user. |
||
153 | * |
||
154 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
155 | */ |
||
156 | public function account() |
||
160 | |||
161 | /** |
||
162 | * Get the roles for the user. |
||
163 | * |
||
164 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
165 | */ |
||
166 | public function roles() |
||
170 | |||
171 | /** |
||
172 | * Get the badges for the user. |
||
173 | * |
||
174 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
175 | */ |
||
176 | public function badges() |
||
180 | |||
181 | /** |
||
182 | * Get the notifications for the user. |
||
183 | * |
||
184 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
185 | */ |
||
186 | public function notifications() |
||
192 | } |
||
193 |