2024-02-27 13:59:16 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
|
|
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Enums\Listen\ObjectEnum;
|
2024-03-13 12:20:44 +01:00
|
|
|
|
use App\Enums\Sections\PageSectionEnum;
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Enums\Slides\SliderTypeEnum;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
use App\Enums\StaticPageType;
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Enums\Testimonials\TypeEnum;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
use App\Http\Controllers\Controller;
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Http\Requests\Fo\ListenFormRequest;
|
|
|
|
|
|
use App\Mail\SendConfirmationMail;
|
|
|
|
|
|
use App\Mail\SendContactMail;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
use App\Models\HistoricalMilestone;
|
2024-03-18 16:10:01 +01:00
|
|
|
|
use App\Models\JobVideo;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
use App\Models\Section;
|
|
|
|
|
|
use App\Models\Site;
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Models\Slide;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
use App\Models\StaticPage;
|
2024-03-11 15:07:25 +01:00
|
|
|
|
use App\Models\Testimonial;
|
|
|
|
|
|
use Illuminate\Support\Facades\Mail;
|
2024-02-27 13:59:16 +01:00
|
|
|
|
|
|
|
|
|
|
class StaticPageController extends Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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->id)->get();
|
|
|
|
|
|
$historicalMilestoneModels = HistoricalMilestone::query()
|
|
|
|
|
|
->orderBy('year', 'ASC')
|
|
|
|
|
|
->get();
|
|
|
|
|
|
$siteModel = Site::query()->first();
|
|
|
|
|
|
|
2024-03-11 15:07:25 +01:00
|
|
|
|
return view('fo.pages.unveil', compact(
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
'sectionModels',
|
|
|
|
|
|
'historicalMilestoneModels',
|
|
|
|
|
|
'siteModel'
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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();
|
|
|
|
|
|
$slideModels = Slide::query()
|
|
|
|
|
|
->whereIn('slider', [SliderTypeEnum::better_life->value, SliderTypeEnum::respect_earth->value])
|
|
|
|
|
|
->get();
|
|
|
|
|
|
$testimonialModels = Testimonial::query()
|
|
|
|
|
|
->whereIn('type', [
|
|
|
|
|
|
TypeEnum::breeding->value,
|
|
|
|
|
|
TypeEnum::better_life->value,
|
|
|
|
|
|
TypeEnum::respect_earth->value,
|
|
|
|
|
|
TypeEnum::feed->value,
|
|
|
|
|
|
TypeEnum::volena->value,
|
2024-03-13 12:20:44 +01:00
|
|
|
|
])->get();
|
|
|
|
|
|
|
|
|
|
|
|
/** Get all sections */
|
|
|
|
|
|
$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();
|
2024-03-11 15:07:25 +01:00
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.commitments', compact(
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
'sectionModels',
|
|
|
|
|
|
'slideModels',
|
2024-03-13 12:20:44 +01:00
|
|
|
|
'testimonialModels',
|
|
|
|
|
|
'ambitionSection',
|
|
|
|
|
|
'breedingSection',
|
|
|
|
|
|
'lifeSection',
|
|
|
|
|
|
'earthSection',
|
|
|
|
|
|
'feedSection',
|
|
|
|
|
|
'testimonialsSection',
|
2024-03-11 15:07:25 +01:00
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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.confidentiality', compact(
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-14 10:09:22 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* Display the 'we_produce' page.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function produce(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::we_produce)->first();
|
2024-03-14 15:25:04 +01:00
|
|
|
|
$sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get();
|
|
|
|
|
|
$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();
|
2024-03-14 10:09:22 +01:00
|
|
|
|
|
2024-03-14 15:25:04 +01:00
|
|
|
|
return view('fo.pages.produce.show', compact(
|
2024-03-14 10:09:22 +01:00
|
|
|
|
'staticPageModel',
|
2024-03-14 15:25:04 +01:00
|
|
|
|
'localSection',
|
|
|
|
|
|
'gmsSection',
|
|
|
|
|
|
'rhdSection',
|
|
|
|
|
|
'exportSection',
|
|
|
|
|
|
'qualitySection'
|
2024-03-14 10:09:22 +01:00
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-11 15:07:25 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* Display the 'we_listen' page.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function listen(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::we_listen)->first();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.listen', compact(
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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()));
|
|
|
|
|
|
|
2024-03-14 10:09:22 +01:00
|
|
|
|
return redirect()->route('fo.listen.show')
|
2024-03-11 15:07:25 +01:00
|
|
|
|
->with('success', trans(
|
|
|
|
|
|
'Bonjour, votre message a bien été transmis, nous vous en remercions. Cordialement, l’équipe :appName.',
|
|
|
|
|
|
['appName' => config('app.name')]
|
|
|
|
|
|
));
|
2024-02-27 13:59:16 +01:00
|
|
|
|
}
|
2024-03-18 16:10:01 +01:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.hire', \compact(
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
'sectionModels',
|
|
|
|
|
|
'videoModels',
|
|
|
|
|
|
'testimonialModels',
|
|
|
|
|
|
'compagnyLifeSection',
|
|
|
|
|
|
'formationSection',
|
|
|
|
|
|
'testimonialSection',
|
|
|
|
|
|
'paritySection',
|
|
|
|
|
|
'findSection'
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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
|
|
|
|
|
|
{
|
|
|
|
|
|
if ($site->order === Site::query()->max('order')) {
|
|
|
|
|
|
$nextSiteModel = Site::query()->orderBy('order')->first();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$nextSiteModel = Site::query()->orderBy('order')->where('order', '>', $site->order)->first();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.site', [
|
|
|
|
|
|
'siteModel' => $site,
|
|
|
|
|
|
'nextSiteModel' => $nextSiteModel
|
|
|
|
|
|
]);
|
|
|
|
|
|
}
|
2024-02-27 13:59:16 +01:00
|
|
|
|
}
|