ldc-tregalette/app/Http/Controllers/Fo/StaticPageController.php

69 lines
2.1 KiB
PHP
Raw Normal View History

2023-12-15 15:53:55 +00:00
<?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)
{
2023-12-19 08:32:01 +01:00
$legalPage = StaticPage::query()->where('type', StaticPageType::legals)->firstOrFail();
return view('fo.pages.legals', ['staticPageModel' => $legalPage]);
2023-12-15 15:53:55 +00:00
}
2025-03-24 16:21:57 +01:00
/**
* Game rules show
*
* @param \App\Models\StaticPage $legalPage
* @return \Illuminate\Contracts\View\View
*/
public function rules(StaticPage $rulesPage)
{
$rulesPage = StaticPage::query()->where('type', StaticPageType::rules)->firstOrFail();
return view('fo.pages.rules', ['staticPageModel' => $rulesPage]);
}
2023-12-15 15:53:55 +00:00
/**
* Policies show
*
* @param \App\Models\StaticPage $policiesPage
* @return \Illuminate\Contracts\View\View
*/
public function policies(StaticPage $policiesPage)
{
2023-12-19 08:32:01 +01:00
$policiesPage = StaticPage::query()->where('type', StaticPageType::confidentiality)->firstOrFail();
return view('fo.pages.legals', ['staticPageModel' => $policiesPage]);
2023-12-15 15:53:55 +00:00
}
/**
* HistoricalMilestone show
*
* @return \Illuminate\Contracts\View\View
*/
public function ourHistory()
{
$newsModels = News::query()
->where('published', true)
->orderBy('created_at', 'desc')
->limit(6)
->get();
2023-12-18 11:51:19 +01:00
$rangeModels = Range::query()->limit(3)->inRandomOrder()->get();
2023-12-15 15:53:55 +00:00
$milestoneModels = HistoricalMilestone::orderBy('year', 'asc')->where('published', true)->get();
2023-12-19 08:32:01 +01:00
$staticPageModel = StaticPage::query()->where('type', StaticPageType::history)->firstOrFail();
2023-12-15 15:53:55 +00:00
return view('fo.pages.history', compact('staticPageModel', 'newsModels', 'rangeModels', 'milestoneModels'));
}
}