155 lines
5.1 KiB
PHP
155 lines
5.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Models\Offer;
|
|
use App\Models\Video;
|
|
use App\Models\KeyNumber;
|
|
use App\Models\Profession;
|
|
use App\Models\StaticPage;
|
|
use App\Models\Testimonial;
|
|
use Detection\MobileDetect;
|
|
use App\Enums\StaticPageType;
|
|
use App\Models\NewsCorporate;
|
|
use App\Models\BrandAdvantage;
|
|
use App\Models\GeneralSetting;
|
|
use App\Models\HistoricalMilestone;
|
|
use App\Enums\Settings\SettingsType;
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Uwil\SitemapGenerator\Lib\SitemapHelper;
|
|
|
|
class StaticPageController extends Controller
|
|
{
|
|
/**
|
|
* Legals page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function legals(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::legals);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Confidentiality page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function policies(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::confidentiality);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Sitemap page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function sitemap(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::sitemap)->first();
|
|
$singlePages = SitemapHelper::getSinglePages();
|
|
|
|
return view('fo.pages.sitemap', ['staticPageModel' => $staticPageModel, 'singlePages' => $singlePages]);
|
|
}
|
|
|
|
/**
|
|
* Rules page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function rules(): \Illuminate\Contracts\View\View
|
|
{
|
|
$rules = StaticPage::query()->where('type', StaticPageType::rules)->first();
|
|
|
|
return view('fo.pages.rules', ['staticPageModel' => $rules]);
|
|
}
|
|
|
|
/**
|
|
* Termes and conditions selling page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function selling(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::selling);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Accessibility page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function accessibility(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::accessibility);
|
|
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
|
|
}
|
|
|
|
/**
|
|
* Recruitment page.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function recruitment(): \Illuminate\Contracts\View\View
|
|
{
|
|
$detect = new MobileDetect();
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recruitment);
|
|
$offerModels = Cache::remember(
|
|
config('services.digital_recruiter.url'),
|
|
86400,
|
|
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::remember(
|
|
sprintf('%s-count', config('services.digital_recruiter.url')),
|
|
86400,
|
|
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.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function story(): \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.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function saga(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::saga);
|
|
$videoModels = Video::get6PublishedVideosOrderedWithProducts();
|
|
return view('fo.pages.saga', compact('staticPageModel', 'videoModels'));
|
|
}
|
|
}
|