feat: add static page game rules
This commit is contained in:
parent
24d39050d3
commit
fcca42fca2
8 changed files with 88 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ enum StaticPageType: int
|
|||
case breedingHealth = 19;
|
||||
case search = 20;
|
||||
case sitemap = 21;
|
||||
case rules = 22;
|
||||
|
||||
/**
|
||||
* Optionnal labels definition.
|
||||
|
|
@ -56,7 +57,8 @@ enum StaticPageType: int
|
|||
self::breedingFood->name => 'L\'alimentation des volailles',
|
||||
self::breedingHealth->name => 'La santé des volailles',
|
||||
self::search->name => 'Recherche',
|
||||
self::sitemap->name => 'Plan du site',
|
||||
self::sitemap->name => 'Plan du site',
|
||||
self::rules->name => 'Règlement du jeu',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -59,6 +59,19 @@ class StaticPageController extends Controller
|
|||
return view('fo.pages.sitemap', ['staticPageModel' => $sitemap, 'singlePages' => $singlePages]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rules page.
|
||||
*
|
||||
* @param \App\Models\StaticPage $staticPage
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function rules(StaticPage $sitemap)
|
||||
{
|
||||
$rules = StaticPage::query()->where('type', StaticPageType::rules)->first();
|
||||
|
||||
return view('fo.pages.rules', ['staticPageModel' => $rules]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Termes and conditions selling page.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ class ViewServiceProvider extends ServiceProvider
|
|||
['name' => 'sellingStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::selling)],
|
||||
['name' => 'accessibilityStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::accessibility)],
|
||||
['name' => 'sitemapStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::sitemap)],
|
||||
['name' => 'rulesStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::rules)],
|
||||
['name' => 'contactStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::contact)],
|
||||
['name' => 'productStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::product)],
|
||||
['name' => 'breedingPoultryStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingPoultry)],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
use App\Models\StaticPage;
|
||||
use App\Enums\StaticPageType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$staticPage = new StaticPage();
|
||||
$staticPage->type = StaticPageType::rules;
|
||||
$staticPage->seo_title = trans(
|
||||
'SEO title pour la page :label',
|
||||
['label' => StaticPageType::rules->label()]
|
||||
);
|
||||
$staticPage->seo_description = trans(
|
||||
'SEO description pour la page :label',
|
||||
['label' => StaticPageType::rules->label()]
|
||||
);
|
||||
$staticPage->title = trans(StaticPageType::rules->label());
|
||||
$staticPage->slug = Str::of(StaticPageType::rules->label())->slug();
|
||||
$staticPage->subtitle = null;
|
||||
$staticPage->picture = null;
|
||||
$staticPage->picture_alt = null;
|
||||
$staticPage->picture_title = null;
|
||||
$staticPage->content = trans('Le contenu de votre page');
|
||||
$staticPage->data = [];
|
||||
$staticPage->saveQuietly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
StaticPage::query()->where('type', StaticPageType::rules)->first()->delete();
|
||||
}
|
||||
};
|
||||
|
|
@ -108,6 +108,7 @@ class StaticPageSeeder extends Seeder
|
|||
]);
|
||||
$this->seedStaticPage(StaticPageType::search);
|
||||
$this->seedStaticPage(StaticPageType::sitemap);
|
||||
$this->seedStaticPage(StaticPageType::rules);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
<li class="list-inline-item me-0">
|
||||
<a href="{{ route('fo.sitemap.show') }}" title="{{ __('Go to page :page', ['page' => 'Plan du site']) }}">{{ __('Plan du site') }}</a>
|
||||
</li>
|
||||
<li class="list-inline-item me-0">-</li>
|
||||
<li class="list-inline-item me-0">
|
||||
<a href="{{ route('fo.rules.show') }}" title="{{ __('Go to page :page', ['page' => 'Règlement du jeu']) }}">{{ __('Règlement du jeu') }}</a>
|
||||
</li>
|
||||
{{-- FIXME:
|
||||
<li class="list-inline-item me-0">-</li>
|
||||
<li class="list-inline-item me-0">
|
||||
|
|
|
|||
18
resources/views/fo/pages/rules.blade.php
Normal file
18
resources/views/fo/pages/rules.blade.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
@extends('fo.layout', ['brParam' => $staticPageModel])
|
||||
|
||||
@section('title', $staticPageModel->seo_title)
|
||||
@section('description', $staticPageModel->seo_description)
|
||||
@section('breadcrumb', request()->route()->getName())
|
||||
@section('bg-offset', true)
|
||||
|
||||
@section('content')
|
||||
{{-- HEADER --}}
|
||||
@include('fo.layouts.header-banner')
|
||||
<div class="container mt-5 pt-5 mb-3">
|
||||
<div class="row mb-5">
|
||||
<div class="col ck-content">
|
||||
{!! clean($staticPageModel->content) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -33,6 +33,7 @@ Route::middleware(['throttle:web'])->name('fo.')->group(function () {
|
|||
Route::get('/conditions-generales-de-vente', [StaticPageController::class, 'selling'])->name('conditions.show');
|
||||
Route::get('/accessibilite', [StaticPageController::class, 'accessibility'])->name('accessibility.show');
|
||||
Route::get('/plan-du-site', [StaticPageController::class, 'sitemap'])->name('sitemap.show');
|
||||
Route::get('/reglement-du-jeu', [StaticPageController::class, 'rules'])->name('rules.show');
|
||||
|
||||
// * SEARCH
|
||||
Route::get('/recherche', [SearchController::class, 'search'])->name('search.index');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue