56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
use App\Enums\StaticPageType;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\StaticPage;
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
class StaticPageController extends Controller
|
|
{
|
|
/**
|
|
* Show the rules view
|
|
*/
|
|
public function reglement(): View
|
|
{
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::rules)->firstOrFail();
|
|
|
|
return $this->viewStaticPage($staticPageModel);
|
|
}
|
|
|
|
/**
|
|
* Show the privacy view
|
|
*/
|
|
public function charte(): View
|
|
{
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::confidentiality)->firstOrFail();
|
|
|
|
return $this->viewStaticPage($staticPageModel);
|
|
}
|
|
|
|
/**
|
|
* Show the legals view
|
|
*/
|
|
public function legals(): View
|
|
{
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::legals)->firstOrFail();
|
|
|
|
return $this->viewStaticPage($staticPageModel);
|
|
}
|
|
|
|
/**
|
|
* Display a static page
|
|
*/
|
|
private function viewStaticPage(StaticPage $staticPageModel): View
|
|
{
|
|
/** @var view-string $view */
|
|
$view = 'theme::pages.static_page';
|
|
|
|
return view($view, [
|
|
'staticPageModel' => $staticPageModel,
|
|
]);
|
|
}
|
|
}
|