'datetime', ]; protected $dates = ['login_at']; public function isAdmin(): bool { return $this->role === 2; } public function memos() : HasMany { return $this->hasMany(Memo::class); } public function images(): MorphMany { return $this->morphMany(Image::class, 'imageable'); } public function profileImage(): MorphOne { return $this->morphOne(Image::class, 'imageable') ->where('location', 'profile') ->orderBy('id', 'desc') ->withDefault(function ($userImage) { $userImage->path = 'images/default-cover.jpg'; }); } public function coverImage(): MorphOne { return $this->morphOne(Image::class, 'imageable') ->where('location', 'cover') ->orderBy('id', 'desc') ->withDefault(function ($userImage) { $userImage->path = 'images/default-cover.jpg'; }); } public function toDoLists(): HasMany { return $this->hasMany(ToDoList::class); } }