Select Git revision
IndexController.php

Sofiane Lasri authored
This commit modifies the IndexController to shuffle the creations and limit the results to the first 8 entries, enhancing the variety displayed on the public interface.
IndexController.php 934 B
<?php
namespace App\Http\Controllers\Public;
use App\Http\Controllers\Controller;
use App\Models\AboutMeSection;
use App\Models\Category;
use App\Models\Creation;
use App\Models\Prestation;
use App\Models\SocialMediaLink;
use Illuminate\View\View;
class IndexController extends Controller
{
public function __invoke(): View
{
$socialMediaLinks = SocialMediaLink::all();
$categories = Category::where('highlight', 1)->get()->load(['nameTranslationKey']);
$creations = Creation::all()->load('coverUploadedPicture')->shuffle()->take(8);
$aboutMeSection = AboutMeSection::where('active', true)->get();
$prestations = Prestation::all()->load(['nameTransKey', 'category', 'uploadedPicture']);
return view('public.index', compact(
'socialMediaLinks',
'categories',
'creations',
'aboutMeSection',
'prestations'));
}
}