| 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 string|null |
||
| 32 | */ |
||
| 33 | public $token; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var array |
||
| 37 | */ |
||
| 38 | protected $fillable = [ |
||
| 39 | 'name', |
||
| 40 | 'email', |
||
| 41 | 'password', |
||
| 42 | 'avatar', |
||
| 43 | ]; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @var array |
||
| 47 | */ |
||
| 48 | protected $hidden = [ |
||
| 49 | 'password', |
||
| 50 | 'remember_token', |
||
| 51 | ]; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $password |
||
| 55 | * @return User |
||
| 56 | */ |
||
| 57 | public function setPasswordAttribute(string $password): User |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param string|null $avatar |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getAvatarAttribute(string $avatar = null): string |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return bool |
||
| 79 | */ |
||
| 80 | public function hasAvatar(): bool |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @return MorphMany |
||
| 87 | */ |
||
| 88 | public function articles(): MorphMany |
||
| 92 | } |
||
| 93 |