ldc-boutique-cnc-sable/app/Http/Controllers/Fo/Pages/HomeController.php
2026-10-27 09:58:12 +01:00

44 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Controllers\Fo\Pages;
use App\Contracts\Directories\ProductDirectory;
use App\Http\Controllers\Controller;
use App\Models\Range;
use App\Models\Slide;
use Illuminate\Contracts\View\View;
use Infrastructure\Adapters\Services\AppCustomerAuthService;
class HomeController extends Controller
{
public function __construct(
private readonly AppCustomerAuthService $authService,
private readonly ProductDirectory $productDirectory,
) {
}
public function index(): View
{
// * Star products.
$starProductList = $this->productDirectory->getStarProductsWithPricing();
$slides = Slide::all();
// * Display only slides visible to connected customers.
if (! $this->authService->check()) {
$slides = $slides->where('connected', false);
}
$rangeList = Range::query()
->where('status', true)
->get();
return view('fo.pages.home', compact(
'starProductList',
'slides',
'rangeList'
));
}
}