where('type', StaticPageType::home)->first(); $sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get(); $stripModels = Strip::query() ->where('published', true) ->orderBy('publish_at', 'DESC') ->limit(6) ->with('news') ->whereHas('news', function (Builder $query) { $query->where('published', true); }) ->get(); $newsModels = News::query() ->where('published', true) ->orderBy('displayed_date', 'DESC') ->limit(4) ->get(); $slideModels = Slide::query()->where('type', SliderTypeEnum::home)->get(); $missionSection = $sectionModels->where('section', PageSectionEnum::home_missions)->first(); $ambitionSection = $sectionModels->where('section', PageSectionEnum::home_ambition)->first(); $teamSection = $sectionModels->where('section', PageSectionEnum::home_team)->first(); $lifeSection = $sectionModels->where('section', PageSectionEnum::home_life)->first(); $slideTeams = Slide::query()->where('type', SliderTypeEnum::team)->get(); return view('fo.pages.home', compact( 'staticPageModel', 'sectionModels', 'stripModels', 'newsModels', 'slideModels', 'missionSection', 'ambitionSection', 'teamSection', 'lifeSection', 'slideTeams', )); } /** * Display the 'unveil' page. * * @return \Illuminate\Contracts\View\View */ public function unveil(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::unveil)->first(); $sectionModels = Section::query()->where('page_id', $staticPageModel->getKey())->get(); $historicalMilestoneModels = HistoricalMilestone::query()->orderBy('year', 'ASC')->get(); /** @var \Illuminate\Database\Eloquent\Collection */ $siteModelList = Site::query()->orderBy('order')->get(); $keySection = $sectionModels->where('section', PageSectionEnum::unveil_pole)->first(); $missionsSection = $sectionModels->where('section', PageSectionEnum::unveil_missions)->first(); $localSection = $sectionModels->where('section', PageSectionEnum::unveil_local)->first(); $siteSection = $sectionModels->where('section', PageSectionEnum::unveil_sites)->first(); $historySection = $sectionModels->where('section', PageSectionEnum::unveil_history)->first(); $commitmentSection = $sectionModels->where('section', PageSectionEnum::unveil_commitments)->first(); $navLinks = Sticky::query()->where('type', StaticPageType::unveil)->get(); $viewBox = null; $initialZoom = null; // * Calcul Viewbox leaflet map (). // Carte page “on se dévoile” : Point central = Laval + rayon = 100 km /** @var \App\Models\Site|null $lavalSite */ $lavalSite = $siteModelList->first(fn(Site $site) => Str::contains($site->name, 'Laval')); if ($lavalSite) { $viewBox = (object) [ 'lat' => $lavalSite->latitude, 'lng' => $lavalSite->longitude ]; $initialZoom = 9; } return view('fo.pages.unveil', compact( 'viewBox', 'initialZoom', 'staticPageModel', 'sectionModels', 'historicalMilestoneModels', 'siteModelList', 'keySection', 'missionsSection', 'localSection', 'siteSection', 'historySection', 'commitmentSection', 'navLinks' )); } /** * Display the 'commitments' page. * * @return \Illuminate\Contracts\View\View */ public function commit(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::we_commit)->first(); $sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get(); $slideLifeModels = Slide::query()->where('type', SliderTypeEnum::better_life)->latest()->get(); $slideEarthModels = Slide::query()->where('type', SliderTypeEnum::respect_earth)->latest()->get(); $testimonialModels = Testimonial::query() ->whereIn('type', [ TypeEnum::breeding->value, TypeEnum::better_life->value, TypeEnum::respect_earth->value, TypeEnum::feed->value, TypeEnum::volena->value, ])->get(); $ambitionSection = $sectionModels->where('section', PageSectionEnum::commit_ambition)->first(); $breedingSection = $sectionModels->where('section', PageSectionEnum::commit_breeding)->first(); $lifeSection = $sectionModels->where('section', PageSectionEnum::commit_living)->first(); $earthSection = $sectionModels->where('section', PageSectionEnum::commit_respect_earth)->first(); $feedSection = $sectionModels->where('section', PageSectionEnum::commit_feed)->first(); $testimonialsSection = $sectionModels->where('section', PageSectionEnum::commit_commitments)->first(); $navLinks = Sticky::query()->where('type', StaticPageType::we_commit)->get(); return view('fo.pages.commitments', compact( 'staticPageModel', 'sectionModels', 'slideLifeModels', 'slideEarthModels', 'testimonialModels', 'ambitionSection', 'breedingSection', 'lifeSection', 'earthSection', 'feedSection', 'testimonialsSection', 'navLinks', )); } /** * Display the 'legals' page. * * @return \Illuminate\Contracts\View\View */ public function legals(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::legals)->first(); return view('fo.pages.legals', compact( 'staticPageModel', )); } /** * Display the 'confidentiality' page. * * @return \Illuminate\Contracts\View\View */ public function confidentiality(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::confidentiality)->first(); return view('fo.pages.legals', compact( 'staticPageModel', )); } /** * Display the 'we_produce' page. * * @return \Illuminate\Contracts\View\View */ public function produce(): \Illuminate\Contracts\View\View { // MODELS. $staticPageModel = StaticPage::query()->where('type', StaticPageType::we_produce)->first(); $sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get(); $networkModels = Network::query()->where('published', true)->orderBy('order')->get(); // SECTIONS. $localSection = $sectionModels->where('section', PageSectionEnum::produce_local)->first(); $gmsSection = $sectionModels->where('section', PageSectionEnum::produce_gms)->first(); $rhdSection = $sectionModels->where('section', PageSectionEnum::produce_rhd)->first(); $exportSection = $sectionModels->where('section', PageSectionEnum::produce_export)->first(); $qualitySection = $sectionModels->where('section', PageSectionEnum::produce_quality)->first(); $networkSection = $sectionModels->where('section', PageSectionEnum::produce_networks)->first(); return view('fo.pages.produce.show', compact( 'staticPageModel', 'networkModels', 'localSection', 'gmsSection', 'rhdSection', 'exportSection', 'qualitySection', 'networkSection', )); } /** * Display the 'we_listen' page. * This page is used to send a contact form. * * @return \Illuminate\Contracts\View\View */ public function listen(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::we_listen)->first(); $sectionModel = Section::query()->where('page_id', $staticPageModel->id)->first(); return view('fo.pages.listen', compact( 'staticPageModel', 'sectionModel', )); } /** * Send listen form data. * * @param \App\Http\Requests\Fo\ListenFormRequest $request * @return \Illuminate\Http\RedirectResponse */ public function listenForm(ListenFormRequest $request): \Illuminate\Http\RedirectResponse { Mail::to(config('mail.contact.' . ObjectEnum::make(intval($request->validated()['object']))->name())) ->send(new SendContactMail((object) $request->validated())); Mail::to($request->validated()['email'])->send(new SendConfirmationMail((object) $request->validated())); return redirect()->route('fo.listen.show') ->with('success', trans( 'Bonjour, votre message a bien été transmis, nous vous en remercions. Cordialement, l’équipe :appName.', ['appName' => config('app.name')] )); } /** * Display a listing of the resource. * * @return \Illuminate\Contracts\View\View */ public function hire(): \Illuminate\Contracts\View\View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::we_hire)->first(); $sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get(); $videoModels = JobVideo::query()->inRandomOrder()->simplePaginate(4); $testimonialModels = Testimonial::query()->where('type', TypeEnum::hire)->get(); $compagnyLifeSection = $sectionModels->where('section', PageSectionEnum::hire_life)->first(); $formationSection = $sectionModels->where('section', PageSectionEnum::hire_formation)->first(); $testimonialSection = $sectionModels->where('section', PageSectionEnum::hire_grow)->first(); $paritySection = $sectionModels->where('section', PageSectionEnum::hire_parity)->first(); $findSection = $sectionModels->where('section', PageSectionEnum::hire_find)->first(); $carouselSectionParity = Carousel::query() ->where('section_id', PageSectionEnum::hire_parity) ->where('published', true) ->orderBy('order') ->get(); $navLinks = Sticky::query()->where('type', StaticPageType::we_hire)->get(); return view('fo.pages.hire', \compact( 'staticPageModel', 'sectionModels', 'videoModels', 'testimonialModels', 'compagnyLifeSection', 'formationSection', 'testimonialSection', 'paritySection', 'findSection', 'carouselSectionParity', 'navLinks' )); } /** * Display a listing of the resource. * * @param \App\Models\Site $site * @return \Illuminate\Contracts\View\View */ public function site(Site $site): \Illuminate\Contracts\View\View { /** @var \Illuminate\Database\Eloquent\Collection */ $siteModels = Site::query()->orderBy('order')->get(); $siteModelList = $siteModels->keyBy('order'); $nextSiteModel = $siteModelList->where( 'order', '>', $site->order )->first(); if ($siteModelList->last()->is($site)) { $nextSiteModel = $siteModelList->first(); } $viewBox = (object) [ 'lat' => $site->latitude, 'lng' => $site->longitude ]; $initialZoom = 10; // Create datas similar to Sticky model. $navLinks = collect([ (object) [ 'title' => $site->sticky_title, 'anchor' => $site->sticky_link, 'color' => StickiesColorEnum::quad, ], ]); return view('fo.pages.site', [ 'siteModelList' => $siteModelList, 'siteModel' => $site, 'nextSiteModel' => $nextSiteModel, 'viewBox' => $viewBox, 'initialZoom' => $initialZoom, 'navLinks' => $navLinks, ]); } }