Skip to content
Snippets Groups Projects
Select Git revision
  • 1de77bfadc3eaa18806157a59e81f22b0c842b97
  • master default protected
2 results

IndexController.php

Blame
  • SofianeLasri's avatar
    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.
    dc8abf37
    History
    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'));
        }
    }