group(function () { Route::post('admin/media', [MediaController::class, 'store']); Route::delete('admin/media/{path}', [MediaController::class, 'destroy']) // Dots are required for the extension, so traversal is refused by the // `(?!.*\.\.)` lookahead rather than by simply omitting the character. // The controller repeats the check; the pattern just keeps obvious // probes from ever reaching the application. ->where('path', 'media\/(?!.*\.\.)[A-Za-z0-9_\-\/\.]+') ->name('admin.media.destroy'); });