'array', 'new_values' => 'array', ]; // ─── Relationships ─────────────────────────────── public function user(): BelongsTo { return $this->belongsTo(User::class); } public function auditable() { return $this->morphTo(); } // ─── Helper Methods ────────────────────────────── public static function log( string $event, Model $model, array $oldValues = [], array $newValues = [], ?string $description = null ): self { return static::create([ 'user_id' => auth()->id(), 'event' => $event, 'auditable_type' => get_class($model), 'auditable_id' => $model->getKey(), 'old_values' => $oldValues, 'new_values' => $newValues, 'description' => $description, 'ip_address' => request()->ip(), 'user_agent' => request()->userAgent(), ]); } }