input('cmd'); $target = $request->input('target'); // Mevcut tüm ilk seviye klasörleri al $documentsPath = storage_path('documents'); $firstLevelDirs = array_map( fn($path) => basename($path), glob($documentsPath . '/*', GLOB_ONLYDIR) ); $firstLevelDirs[] = "/"; // Hedef klasörün gerçek yolunu al if ($target && strpos($target, 'l1_') === 0) { $decodedTarget = base64_decode(substr($target, 3)); if (in_array($decodedTarget, $firstLevelDirs)) { $restrictedCommands = ['rm', 'rename', 'move']; if (in_array($cmd, $restrictedCommands)) { return response()->json([ 'error' => 'You cannot perform this operation on directories in the main folder!' ]); } } } return $next($request); } }