mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-14 23:23:37 +08:00
27 lines
533 B
PHP
27 lines
533 B
PHP
|
<?php
|
||
|
|
||
|
namespace BookStack\Exports\ZipExports;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||
|
use ZipArchive;
|
||
|
|
||
|
class ZipFileReferenceRule implements ValidationRule
|
||
|
{
|
||
|
public function __construct(
|
||
|
protected ZipValidationHelper $context,
|
||
|
) {
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @inheritDoc
|
||
|
*/
|
||
|
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||
|
{
|
||
|
if (!$this->context->zipFileExists($value)) {
|
||
|
$fail('validation.zip_file')->translate();
|
||
|
}
|
||
|
}
|
||
|
}
|