55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\HistoricalMilestone;
|
|
use App\Models\News;
|
|
use App\Models\Range;
|
|
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]]);
|
|
}
|
|
|
|
/**
|
|
* HistoricalMilestone show
|
|
*
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function ourHistory()
|
|
{
|
|
$newsModels = News::query()
|
|
->where('published', true)
|
|
->orderBy('created_at', 'desc')
|
|
->limit(6)
|
|
->get();
|
|
$rangeModels = Range::query()->limit(3)->inRandomOrder()->get();
|
|
$milestoneModels = HistoricalMilestone::orderBy('year', 'asc')->where('published', true)->get();
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::history)->first();
|
|
return view('fo.pages.history', compact('staticPageModel', 'newsModels', 'rangeModels', 'milestoneModels'));
|
|
}
|
|
}
|