53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\Sections\PageSectionEnum;
|
|
use App\Enums\Slides\SliderTypeEnum;
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\News;
|
|
use App\Models\Section;
|
|
use App\Models\Slide;
|
|
use App\Models\StaticPage;
|
|
use App\Models\Strip;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function show(): \Illuminate\Contracts\View\View
|
|
{
|
|
$staticPageModel = StaticPage::query()->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')
|
|
->get();
|
|
$newsModels = News::query()->where('published', true)
|
|
->orderBy('publish_at', 'DESC')
|
|
->limit(4)
|
|
->get();
|
|
$slideModels = Slide::query()->where('slider', 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();
|
|
|
|
return view('fo.pages.home', compact(
|
|
'staticPageModel',
|
|
'sectionModels',
|
|
'stripModels',
|
|
'newsModels',
|
|
'slideModels',
|
|
'missionSection',
|
|
'ambitionSection',
|
|
'teamSection',
|
|
'lifeSection',
|
|
));
|
|
}
|
|
}
|