ldc-boutique-cnc-sable/app/Lib/Helpers/RequestHelper.php
Jérémy Munsch 3b3997d547
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-27 09:58:44 +01:00

49 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Lib\Helpers;
use Illuminate\Http\Request as HttpRequest;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Shared\Pagination\Pagination;
use Uri\Rfc3986\Uri;
final class RequestHelper
{
private function __construct()
{
// Static class
}
public static function pagination(HttpRequest $request, int $defaultPageSize = 25): Pagination
{
if ($request->has('offset') || $request->has('limit')) {
return Pagination::ofOffsetAndLimit(
$request->integer('offset', 0),
$request->integer('limit', $defaultPageSize)
);
}
$pageSize = $request->integer(
'pageSize',
$request->integer('per_page', $request->integer('pagination', $defaultPageSize))
);
return Pagination::ofPage(
new PageNumber($request->integer('page', 1)),
new PageSize($pageSize)
);
}
public static function toUri(HttpRequest $request): Uri
{
return new Uri($request->url());
}
public static function toFullUri(HttpRequest $request): Uri
{
return new Uri($request->fullUrl());
}
}