Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

bytefury/crater

8213 stars
2 code files
View bytefury/crater on GitHub

app/Rules/Backup/PathToZip.php

Open in GitHub
use 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 GitHub
use Illuminate\Http\Request;
use Crater\Rules\Backup\PathToZip;
 
class DownloadBackupController extends ApiController
{
public function __invoke(Request $request)
{
$validated = $request->validate([
'path' => ['required', new PathToZip()],
]);
//
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.