44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Bo\Pages;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Infrastructure\Adapters\Services\AppAdminAuthService;
|
|
|
|
class UpdatePageRequest extends FormRequest
|
|
{
|
|
public function __construct(
|
|
private readonly AppAdminAuthService $authService
|
|
) {
|
|
}
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return $this->authService->check();
|
|
}
|
|
|
|
/** @return array<string,mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'seo_title' => ['required', 'string', 'between:45,70'],
|
|
'seo_description' => ['required', 'string', 'between:50,160'],
|
|
'title' => ['nullable', 'string', 'min:3', 'max:255'],
|
|
'content' => ['required', 'string'],
|
|
];
|
|
}
|
|
|
|
#[\Override]
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'seo_title' => trans('validation.custom.attributes.seo_title'),
|
|
'seo_description' => trans('validation.custom.attributes.seo_description'),
|
|
'title' => trans('validation.attributes.title'),
|
|
'content' => trans('validation.attributes.content'),
|
|
|
|
];
|
|
}
|
|
}
|