'array', 'sent_via_email' => 'boolean', 'sent_via_discord' => 'boolean', 'is_read' => 'boolean', 'read_at' => 'datetime', ]; public function markAsRead(): void { $this->update([ 'is_read' => true, 'read_at' => now(), ]); } public function scopeUnread($query) { return $query->where('is_read', false); } public function scopeByType($query, string $type) { return $query->where('type', $type); } public function scopeBySeverity($query, string $severity) { return $query->where('severity', $severity); } public function scopeCritical($query) { return $query->where('severity', 'critical'); } }