'datetime:d-m-Y']; // protected $dateFormat = 'd-m-Y'; public function user() { return $this->belongsTo(User::class)->withDefault([ 'name' => 'Guest Author', ]); } public function meals() { return $this->hasMany(Meal::class); } public function scopeUserToDayItem($query, $userId) { return $query ->where('user_id', $userId) ->where('date', now()->format('Y-m-d')); } public function consultant_comments() { return $this->hasMany(ConsultantDiaryComment::class); } protected function hasComments(): Attribute { return Attribute::make( get: fn () => $this->consultant_comments()->count() > 0, ); } }