ldc-bien-etre-animal/app/Http/Controllers/Front/LegacyPageController.php
2026-09-01 15:04:11 +02:00

44 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Controllers\Front;
use Illuminate\Support\Facades\App;
use Inertia\Inertia;
use Inertia\Response;
use Uwil\LaravelCommon\Controllers\CommonController;
class LegacyPageController extends CommonController
{
public function confidentialite(): Response
{
return $this->render('confidentialite');
}
public function mentionsLegales(): Response
{
return $this->render('mentions_legales');
}
private function render(string $page): Response
{
$locale = App::currentLocale();
$viewName = match ($locale) {
'fr' => "front.legacy.fr.{$page}",
'en' => "front.legacy.en.{$page}",
default => "front.legacy.fr.{$page}",
};
$trans = trans("legacy.{$page}");
return Inertia::render('front/Pages/LegacyPage', [
'metaTitle' => $trans['meta']['title'],
'headerTitle' => $trans['header']['title'],
'heading' => $trans['heading'],
// @phpstan-ignore-next-line argument.type
'content' => view($viewName)->render(),
]);
}
}