28 lines
539 B
PHP
28 lines
539 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Files;
|
|
|
|
use App\Http\Requests\ApiFormRequest;
|
|
|
|
class FileNameRequest extends ApiFormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255', 'regex:/^[^\/\\\\]+$/'],
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
if ($this->route('name') !== null) {
|
|
$this->merge(['name' => $this->route('name')]);
|
|
}
|
|
}
|
|
}
|