1 | <?php |
||
20 | class User extends Model implements |
||
21 | AuthenticatableContract, |
||
22 | AuthorizableContract, |
||
23 | CanResetPasswordContract, |
||
24 | HasRoleAndPermissionContract, |
||
25 | HasMediaConversions |
||
26 | { |
||
27 | use Authenticatable, |
||
28 | Authorizable, |
||
29 | CanResetPassword, |
||
30 | Notifiable, |
||
31 | SoftDeletes, |
||
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 attributes that should be mutated to dates. |
||
87 | * |
||
88 | * @var array |
||
89 | */ |
||
90 | protected $dates = [ |
||
91 | 'deleted_at' |
||
92 | ]; |
||
93 | |||
94 | /** |
||
95 | * Return the field to slug. |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | public function slugStrategy(): string |
||
103 | |||
104 | /** |
||
105 | * Register the related to the Model. |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | public function registerMediaConversions() |
||
129 | |||
130 | /** |
||
131 | * Get the comments for the user. |
||
132 | * |
||
133 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
134 | */ |
||
135 | public function comments() |
||
139 | |||
140 | /** |
||
141 | * Get the articles for the user. |
||
142 | * |
||
143 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
144 | */ |
||
145 | public function articles() |
||
149 | |||
150 | /** |
||
151 | * Get the account for the user. |
||
152 | * |
||
153 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
154 | */ |
||
155 | public function account() |
||
159 | |||
160 | /** |
||
161 | * Get the roles for the user. |
||
162 | * |
||
163 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
164 | */ |
||
165 | public function roles() |
||
169 | |||
170 | /** |
||
171 | * Get the badges for the user. |
||
172 | * |
||
173 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
174 | */ |
||
175 | public function badges() |
||
179 | } |
||
180 |