'boolean', 'read_at' => 'datetime', ]; } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function markAsRead(): void { if (! $this->is_read) { $this->update(['is_read' => true, 'read_at' => now()]); } } #[Scope] public function unread(Builder $query): void { $query->where('is_read', false); } }