ldc-cocotte/app/Http/Requests/Bo/ChangeSelectedOrderRequest.php
Jérémy Munsch d0efb0f527
refactor: update namespaces for actions and queries
Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
2026-11-10 15:13:26 +01:00

42 lines
1,009 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests\Bo;
use App\Cqs\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'),
);
}
}