mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-02 05:10:59 +00:00
27 lines
656 B
PHP
27 lines
656 B
PHP
<?php
|
|
|
|
namespace App\Platform\Storage\Rules;
|
|
|
|
use Closure;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
|
|
/**
|
|
* Accepts only a disk the backup package is configured to write archives to.
|
|
*/
|
|
class BackupDisk implements ValidationRule
|
|
{
|
|
public function __construct() {}
|
|
|
|
/**
|
|
* Reject anything outside the configured backup destinations.
|
|
*/
|
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
|
{
|
|
$destinations = config('backup.backup.destination.disks');
|
|
|
|
if (! in_array($value, $destinations)) {
|
|
$fail('This disk is not configured as a backup disk.');
|
|
}
|
|
}
|
|
}
|