71 lines
2.2 KiB
PHP
71 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Homepage;
|
|
use App\Models\News;
|
|
use App\Models\Range;
|
|
use App\Models\SeasonalSection;
|
|
use App\Models\StaticPage;
|
|
|
|
class StaticPageController extends Controller
|
|
{
|
|
/**
|
|
* Legal show
|
|
*
|
|
* @param \App\Models\StaticPage $legalPage
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function legals(StaticPage $legalPage)
|
|
{
|
|
$legalPage = StaticPage::query()->where('type', StaticPageType::legals)
|
|
->get();
|
|
return view('fo.pages.legals', ['staticPageModel' => $legalPage[0]]);
|
|
}
|
|
|
|
/**
|
|
* Policies show
|
|
*
|
|
* @param \App\Models\StaticPage $policiesPage
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function policies(StaticPage $policiesPage)
|
|
{
|
|
$policiesPage = StaticPage::query()->where('type', StaticPageType::confidentiality)
|
|
->get();
|
|
return view('fo.pages.legals', ['staticPageModel' => $policiesPage[0]]);
|
|
}
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function homepage(): \Illuminate\Contracts\View\View
|
|
{
|
|
/** @var \App\Models\Homepage $homepageModel */
|
|
$homepageModel = Homepage::query()->firstOrFail();
|
|
|
|
/** @var \App\Models\StaticPage $staticPageModel */
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::home)->firstOrFail();
|
|
|
|
/** @var \App\Models\SeasonalSection $seasonalSectionsModel */
|
|
$seasonalSectionsModel = SeasonalSection::query()->where('published', true)->first();
|
|
|
|
/** @var \App\Models\News $newsModels */
|
|
$newsModels = News::query()->where('published', true)->latest('publish_at')->limit(2)->get();
|
|
|
|
/** @var \App\Models\Range $rangeModels */
|
|
$rangeModels = Range::query()->where('published', true)->orderBy('order')->get();
|
|
|
|
return view('fo.pages.home', compact(
|
|
'homepageModel',
|
|
'staticPageModel',
|
|
'seasonalSectionsModel',
|
|
'newsModels',
|
|
'rangeModels',
|
|
));
|
|
}
|
|
}
|