ldc-boutique-cnc-sable/app/Http/Requests/Bo/ChangeOrderRequest.php
2026-10-27 09:58:12 +01:00

45 lines
931 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests\Bo;
use Illuminate\Foundation\Http\FormRequest;
use Infrastructure\Adapters\Services\AppAdminAuthService;
class ChangeOrderRequest extends FormRequest
{
public function __construct(
private readonly AppAdminAuthService $authService
) {
}
public function authorize(): bool
{
return $this->authService->check();
}
#[\Override]
protected function prepareForValidation()
{
$this->merge([
'action' => $this->route('action'),
]);
}
#[\Override]
protected function passedValidation()
{
$this->merge([
'direction' => strval($this->route('action')) === 'up',
]);
}
/** @return array<string,mixed>*/
public function rules(): array
{
return [
'action' => ['required', 'string', 'in:up,down'],
];
}
}