ldc-boutique-cnc-sable/app/Http/Requests/Bo/ChangeSelectedOrderRequest.php
Jérémy Munsch 8e42639134
feat(order): implement change selected order functionality
Add functionality to change the order of models in the product list.
This includes new actions, requests, and UI components for user interaction.
2026-10-29 16:39:23 +01:00

42 lines
1,005 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests\Bo;
use App\Actions\Common\ChangeModelOrderPositionInput;
use App\Interfaces\ModelWithOrder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Http\FormRequest;
use Infrastructure\Adapters\Services\AppAdminAuthService;
class ChangeSelectedOrderRequest 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 [
'order' => ['required', 'integer', 'min:1'],
];
}
public function toChangeModelOrderPositionInput(Model & ModelWithOrder $model): ChangeModelOrderPositionInput
{
return new ChangeModelOrderPositionInput(
model: $model,
targetOrder: $this->integer('order'),
);
}
}