134 lines
4.8 KiB
PHP
134 lines
4.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\Settings\SettingsType;
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\BrandAdvantage;
|
|
use App\Models\GeneralSetting;
|
|
use App\Models\HistoricalMilestone;
|
|
use App\Models\KeyNumber;
|
|
use App\Models\NewsCorporate;
|
|
use App\Models\Offer;
|
|
use App\Models\Profession;
|
|
use App\Models\StaticPage;
|
|
use App\Models\Testimonial;
|
|
use App\Models\Video;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Detection\MobileDetect;
|
|
|
|
class StaticPageController extends Controller
|
|
{
|
|
/**
|
|
* Legals page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function legals(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::legals);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Confidentiality page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function policies(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::confidentiality);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Termes and conditions selling page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function selling(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::selling);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Accessibility page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function accessibility(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::accessibility);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Recruitment page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function recruitment(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$detect = new MobileDetect();
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recruitment);
|
|
$offerModels = Cache::rememberForever(
|
|
config('services.digital_recruiter.url'),
|
|
fn() => Offer::query()->where('published', true)->orderBy('publish_at', 'DESC')->take(6)->get()
|
|
);
|
|
$professionModels = Profession::getRandomPublished();
|
|
$brandAdvantageModels = BrandAdvantage::getPublishedOrdered();
|
|
$newsCorporateModels = NewsCorporate::get9PublishedOrderedByUpdatedAt();
|
|
if ($detect->isMobile()) {
|
|
$newsCorporateModels = $newsCorporateModels->take(3);
|
|
}
|
|
$digitalRecruiterCount = Cache::rememberForever(
|
|
sprintf('%s-count', config('services.digital_recruiter.url')),
|
|
fn() => GeneralSetting::query()->where('type', SettingsType::offersCount)->firstOrFail()->value['count']
|
|
);
|
|
$testimonialModels = Testimonial::getPublishedOrdered();
|
|
return view('fo.pages.recruitment', compact(
|
|
'staticPageModel',
|
|
'offerModels',
|
|
'professionModels',
|
|
'brandAdvantageModels',
|
|
'digitalRecruiterCount',
|
|
'testimonialModels',
|
|
'newsCorporateModels',
|
|
'detect'
|
|
));
|
|
}
|
|
|
|
/**
|
|
* Who are we page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function story(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::story);
|
|
$keyNumberModels = KeyNumber::get5PublishedOrdered();
|
|
$historicalMilestoneModels = HistoricalMilestone::getPublishedOrdered();
|
|
return view('fo.pages.story', compact('staticPageModel', 'keyNumberModels', 'historicalMilestoneModels'));
|
|
}
|
|
|
|
/**
|
|
* Advertising saga page.
|
|
*
|
|
* @param \App\Models\StaticPage $staticPageModel
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function saga(StaticPage $staticPageModel)
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::saga);
|
|
$videoModels = Video::get6PublishedVideosOrderedWithProducts();
|
|
return view('fo.pages.saga', compact('staticPageModel', 'videoModels'));
|
|
}
|
|
}
|