ldc-cocotte/app/Http/Controllers/Fo/Pages/HomeController.php
Jérémy Munsch 74ab9b3041
refactor: reorganize imports across multiple controllers and jobs
This commit refactors the import statements in various controllers and jobs
to improve code organization and readability. Unused imports were removed,
and necessary imports were added to ensure proper functionality.
2026-11-10 18:15:32 +01:00

66 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Controllers\Fo\Pages;
use App\Contracts\Executor;
use App\Cqs\Queries\Products\GetPaginatedProductsQuery;
use App\Cqs\Queries\Products\GetPaginatedProductsQueryInput;
use App\Cqs\Queries\Ranges\GetPaginatedRangesQuery;
use App\Cqs\Queries\Ranges\GetPaginatedRangesQueryInput;
use App\Cqs\Queries\Slides\GetPaginatedSlidesQuery;
use App\Cqs\Queries\Slides\GetPaginatedSlidesQueryInput;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
use Infrastructure\Adapters\Services\AppCustomerAuthService;
use Shared\Pagination\Pagination;
class HomeController extends Controller
{
public function __construct(
private readonly AppCustomerAuthService $authService,
private readonly Executor $executor,
) {
}
public function index(
GetPaginatedProductsQuery $productsAction,
GetPaginatedSlidesQuery $slidesAction,
GetPaginatedRangesQuery $rangesAction
): View {
$starProductList = $this->executor->execute(
$productsAction,
new GetPaginatedProductsQueryInput(
Pagination::firstPage(),
starOnly: true,
publishedOnly: true,
withPricing: true,
)
)->items();
$slideList = $this->executor->execute(
$slidesAction,
new GetPaginatedSlidesQueryInput(
Pagination::firstPage(),
publishedOnly: true,
forConnectedCustomers: $this->authService->check()
)
)->items();
$rangeList = $this->executor->execute(
$rangesAction,
new GetPaginatedRangesQueryInput(
Pagination::firstPage(),
publishedOnly: true
)
)->items();
return view('fo.pages.home', compact(
'starProductList',
'slideList',
'rangeList'
));
}
}