Gender::class, 'birthday' => 'date', 'password' => 'hashed', ]; public function patients() { return $this->hasMany(Patient::class, 'user_id'); } protected function age(): Attribute { return new Attribute( get: fn () => $this->birthday ? $this->birthday->diffInYears() : '', ); } protected function sexText(): Attribute { return new Attribute( get: fn () => $this->sex ? $this->sex->text() : '', ); } protected function birthdayFormat(): Attribute { return new Attribute( get: fn () => $this->birthday ? $this->birthday->format('Y-m-d') : '', ); } public function scopeSort($q) { return $q->orderBy('created_at', 'desc'); } }