1 | <?php |
||
20 | class User extends Authenticatable |
||
21 | { |
||
22 | use Notifiable; |
||
23 | |||
24 | public const DEFAULT_AVATAR_PATH = '/static/avatars/'; |
||
25 | public const DEFAULT_AVATAR_NAME = 'default/1.png'; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $fillable = [ |
||
31 | 'name', 'email', 'password', 'avatar', |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $hidden = [ |
||
38 | 'password', 'remember_token', |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * @param string $password |
||
43 | * @return User |
||
44 | */ |
||
45 | public function setPasswordAttribute(string $password): User |
||
51 | |||
52 | /** |
||
53 | * @param string|null $avatar |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getAvatarAttribute(string $avatar = null): string |
||
64 | |||
65 | /** |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function hasAvatar(): bool |
||
72 | |||
73 | /** |
||
74 | * @return MorphToMany |
||
75 | */ |
||
76 | public function articles(): MorphToMany |
||
80 | } |
||
81 |