id ?? null) : null; ActivityLog::create([ 'user_id' => Auth::id(), 'action' => $action, 'model' => $modelName, // Sekarang tidak akan NULL 'model_id' => $modelId, 'description' => $description, 'ip_address' => request()->ip(), // getChanges() hanya untuk update; saat delete kita kirim null atau data asli 'properties' => ($modelInstance && method_exists($modelInstance, 'getChanges')) ? $modelInstance->getChanges() : null, ]); } } }