'array', 'created_at' => 'datetime', ]; // Polymorphic relationship public function loggable() { return $this->morphTo(); } // Scopes public function scopeForEvent($query, string $eventType) { return $query->where('event_type', $eventType); } public function scopeByIp($query, string $ip) { return $query->where('ip_address', $ip); } public function scopeRecent($query, $hours = 24) { return $query->where('created_at', '>=', now()->subHours($hours)); } }