'datetime', 'replied_at' => 'datetime', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; public function scopeUnread(Builder $query): Builder { return $query->where('status', 'unread'); } public function scopeRead(Builder $query): Builder { return $query->where('status', 'read'); } public function scopeReplied(Builder $query): Builder { return $query->where('status', 'replied'); } public function markAsRead(): void { $this->update([ 'status' => 'read', 'read_at' => now(), ]); } public function markAsReplied(): void { $this->update([ 'status' => 'replied', 'replied_at' => now(), ]); } public function archive(): void { $this->update([ 'status' => 'archived', ]); } public function getStatusColorAttribute(): string { return match ($this->status) { 'unread' => 'danger', 'read' => 'warning', 'replied' => 'success', 'archived' => 'gray', default => 'gray', }; } public function getFormattedStatusAttribute(): string { return match ($this->status) { 'unread' => 'Unread', 'read' => 'Read', 'replied' => 'Replied', 'archived' => 'Archived', default => ucfirst($this->status), }; } }