| 1 | <?php |
||
| 22 | class User extends Authenticatable implements GravatarSupports |
||
| 23 | { |
||
| 24 | use Notifiable; |
||
| 25 | use GravatarSupport; |
||
| 26 | |||
| 27 | public const DEFAULT_AVATAR_PATH = '/static/avatars/'; |
||
| 28 | public const DEFAULT_AVATAR_NAME = 'default/1.png'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var array |
||
| 32 | */ |
||
| 33 | protected $fillable = [ |
||
| 34 | 'name', |
||
| 35 | 'email', |
||
| 36 | 'password', |
||
| 37 | 'avatar', |
||
| 38 | ]; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | protected $hidden = [ |
||
| 44 | 'password', |
||
| 45 | 'remember_token', |
||
| 46 | ]; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $password |
||
| 50 | * @return User |
||
| 51 | */ |
||
| 52 | public function setPasswordAttribute(string $password): User |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string|null $avatar |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | public function getAvatarAttribute(string $avatar = null): string |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return bool |
||
| 74 | */ |
||
| 75 | public function hasAvatar(): bool |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return MorphMany |
||
| 82 | */ |
||
| 83 | public function articles(): MorphMany |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return bool |
||
| 90 | */ |
||
| 91 | public function isGuest(): bool |
||
| 95 | } |
||
| 96 |