update static pages with default view

This commit is contained in:
Alexis Gousseau 2023-12-14 15:18:38 +01:00
parent 916e188a8b
commit 2fae77e1ac
4 changed files with 78 additions and 3 deletions

View file

@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers\Fo;
use App\Enums\StaticPageType;
use App\Http\Controllers\Controller;
use App\Models\StaticPage;
class StaticPageController extends Controller
{
/**
* Contact show
*
* @param \App\Models\StaticPage $contactPage
* @return \Illuminate\Contracts\View\View
*/
public function contact(StaticPage $contactPage)
{
$contactPage = StaticPage::query()->where('type', StaticPageType::contact)->first();
return view('fo.pages.legals', ['staticPageModel' => $contactPage]);
}
/**
* Legal show
*
* @param \App\Models\StaticPage $legalPage
* @return \Illuminate\Contracts\View\View
*/
public function legals(StaticPage $legalPage)
{
$legalPage = StaticPage::query()->where('type', StaticPageType::legals)->first();
return view('fo.pages.legals', ['staticPageModel' => $legalPage]);
}
/**
* Policies show
*
* @param \App\Models\StaticPage $policiesPage
* @return \Illuminate\Contracts\View\View
*/
public function policies(StaticPage $policiesPage)
{
$policiesPage = StaticPage::query()->where('type', StaticPageType::confidentiality)->first();
return view('fo.pages.legals', ['staticPageModel' => $policiesPage]);
}
}

View file

@ -20,9 +20,9 @@ class StaticPageSeeder extends Seeder
'type' => StaticPageType::contact,
],
[
'seo_title' => 'Seo title pour la page contactez nous',
'seo_description' => 'Seo description pour la page contactez nous',
'title' => 'Contactez-nous',
'seo_title' => 'Seo title pour la page contact',
'seo_description' => 'Seo description pour la page contact',
'title' => 'Contact',
'type' => StaticPageType::contact,
'content' => \clean(\fake()->randomHtml(6, 7)),
]

View file

@ -0,0 +1,23 @@
@extends('fo.layout')
@section('title', __($staticPageModel->seo_title))
@section('description', __($staticPageModel->seo_description))
@section('breadcrumb',
request()->route()->getName())
@section('content')
<div class="container">
<div class="row">
<div class="col">
<h1 class="f-intro-head-h-base text-center">{{ __($staticPageModel->title) }}</h1>
</div>
</div>
</div>
<div class="container">
<div class="row mb-5">
<div class="col ck-content">
{!! clean($staticPageModel->content) !!}
</div>
</div>
</div>
@endsection

View file

@ -1,6 +1,7 @@
<?php
use App\Http\Controllers\Fo\HomeController;
use App\Http\Controllers\Fo\StaticPageController;
use Illuminate\Support\Facades\Route;
Route::middleware(['throttle:credentials'])
@ -12,4 +13,9 @@ Route::middleware(['throttle:credentials'])
}
Route::get('/', [HomeController::class, 'index'])->name('homepage');
Route::get('/contact', [StaticPageController::class, 'contact'])->name('contact.show');
// * LEGALS
Route::get('/mentions-legales', [StaticPageController::class, 'legals'])->name('legals.show');
Route::get('/charte-de-confidentialite', [StaticPageController::class, 'policies'])->name('policies.show');
});