-
app/Rules/Backup/PathToZip.php
Open in GitHubuse Illuminate\Contracts\Validation\Rule; use Illuminate\Support\Str; class PathToZip implements Rule { public function passes($attribute, $value) { return Str::endsWith($value, '.zip'); } public function message() { return 'The given value must be a path to a zip file.'; } }
-
app/Http/Controllers/V1/Backup/DownloadBackupController.php
Open in GitHubuse Illuminate\Http\Request; use Crater\Rules\Backup\PathToZip; class DownloadBackupController extends ApiController { public function __invoke(Request $request) { $validated = $request->validate([ 'path' => ['required', new PathToZip()], ]); // } }