'array', 'read_at' => 'datetime', 'sent_at' => 'datetime', ]; } /** * Get the user that owns the notification. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Mark the notification as read. */ public function markAsRead(): void { $this->update(['read_at' => now()]); } /** * Scope to filter unread notifications. */ public function scopeUnread($query) { return $query->whereNull('read_at'); } }