fix: 🐛 update dynamic pages routes
This commit is contained in:
parent
311a6b0ddb
commit
ba0585ab10
17 changed files with 220 additions and 162 deletions
|
|
@ -109,10 +109,8 @@ class DynamicPage extends Model implements TranslatableModel
|
|||
{
|
||||
static::creating(function (self $model) {
|
||||
self::manageFields($model);
|
||||
// Set id_key from slug or title when the dynamic page is root.
|
||||
$model->id_key = isset($model->slug) && !empty($model->slug)
|
||||
? $model->slug
|
||||
: Str::slug($model->title);
|
||||
// Set id_key from title.
|
||||
$model->id_key = Str::slug($model->title);
|
||||
});
|
||||
static::updating(function (self $model) {
|
||||
self::manageFields($model);
|
||||
|
|
@ -254,9 +252,10 @@ class DynamicPage extends Model implements TranslatableModel
|
|||
*/
|
||||
public static function assertRootIsUnique(self $model): void
|
||||
{
|
||||
$oldDynamicPageRoot = self::getModelsCached()->where('isRoot', true)->first();
|
||||
$oldDynamicPageRoot = self::getModelsCached()->where('id', '!=', $model->getKey())->where('isRoot', true)->first();
|
||||
if ($oldDynamicPageRoot) {
|
||||
$oldDynamicPageRoot->isRoot = false;
|
||||
$oldDynamicPageRoot->publish = PageStatusEnum::unpublished;
|
||||
$oldDynamicPageRoot->isRoot = false;
|
||||
$oldDynamicPageRoot->saveQuietly();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Enums\DynamicFieldTypes;
|
||||
use App\Enums\DynamicPages\PageStatusEnum;
|
||||
use App\Models\DynamicPage;
|
||||
|
|
@ -19,18 +20,21 @@ class DynamicPageFactory extends Factory
|
|||
public function definition(): array
|
||||
{
|
||||
$title = fake()->unique()->word();
|
||||
$slug = Str::slug($title);
|
||||
$configModel = fake()->randomElement(PageConfig::all());
|
||||
$status = fake()->randomElement(PageStatusEnum::cases());
|
||||
$pageHome = DynamicPage::query()->where('isRoot', true)->firstOrFail();
|
||||
|
||||
return [
|
||||
'id_key' => Str::slug($title),
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title),
|
||||
'content' => self::getDataFromConfig($configModel),
|
||||
'page_id' => null,
|
||||
'config_id' => $configModel->getKey(),
|
||||
'status' => $status,
|
||||
'isLocked' => fake()->boolean(50),
|
||||
'id_key' => $slug,
|
||||
'title' => $title,
|
||||
'slug' => $slug,
|
||||
'content' => self::getDataFromConfig($configModel),
|
||||
'page_id' => $pageHome->getKey(),
|
||||
'config_id' => $configModel->getKey(),
|
||||
'status' => $status,
|
||||
'isLocked' => fake()->boolean(25),
|
||||
'deleted_at' => fake()->boolean(25) ? Carbon::now() : null,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ class NewsFactory extends Factory
|
|||
'status' => collect(NewsStatusEnum::cases())->random(),
|
||||
'picture_alt' => fake()->sentence(6, true),
|
||||
'picture_title' => fake()->sentence(6, true),
|
||||
'picture' => 'temp.jpg',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ class PageConfigFactory extends Factory
|
|||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,14 @@ class DatabaseSeeder extends Seeder
|
|||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Set locale to the fallback.
|
||||
app()->setLocale(config('app.fallback_locale'));
|
||||
|
||||
// Call seeders.
|
||||
$this->call([
|
||||
PageConfigSeeder::class,
|
||||
DynamicPageSeeder::class,
|
||||
NewsCategorySeeder::class,
|
||||
NewsSeeder::class,
|
||||
CompanySeeder::class,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\DynamicPages\PageStatusEnum;
|
||||
use App\Enums\DynamicFieldTypes;
|
||||
use App\Models\DynamicPage;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
|
@ -17,23 +18,59 @@ class DynamicPageSeeder extends Seeder
|
|||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DynamicPage::factory(10)->make()
|
||||
->each(function ($model) {
|
||||
$content = $model->content;
|
||||
// Config factories add just one depth of children.
|
||||
foreach ($model->content as $key => $value) {
|
||||
$prefix = sprintf("%s_", DynamicFieldTypes::image->name);
|
||||
if (Str::startsWith($key, $prefix)) {
|
||||
$content[$key] = FileHelper::storeFile(
|
||||
$model,
|
||||
new \SplFileInfo(\resource_path(
|
||||
'../database/factories/assets/dynamic-pages/100x100.jpg'
|
||||
))
|
||||
);
|
||||
}
|
||||
// Mandatory dynamic pages.
|
||||
$titleHome = "Accueil";
|
||||
$dynamicPageModel = new DynamicPage;
|
||||
$dynamicPageModel->id_key = Str::slug($titleHome);
|
||||
$dynamicPageModel->slug = "";
|
||||
$dynamicPageModel->title = $titleHome;
|
||||
$dynamicPageModel->content = [];
|
||||
$dynamicPageModel->status = PageStatusEnum::published;
|
||||
$dynamicPageModel->isLocked = true;
|
||||
$dynamicPageModel->isRoot = true;
|
||||
$dynamicPageModel->saveOrFail();
|
||||
|
||||
$titlePrivacyPolicy = "Politique de confidentialité";
|
||||
$slugPrivacyPolicy = Str::slug($titlePrivacyPolicy);
|
||||
$dynamicPageModel = new DynamicPage;
|
||||
$dynamicPageModel->id_key = $slugPrivacyPolicy;
|
||||
$dynamicPageModel->slug = $slugPrivacyPolicy;
|
||||
$dynamicPageModel->title = $titlePrivacyPolicy;
|
||||
$dynamicPageModel->content = [];
|
||||
$dynamicPageModel->status = PageStatusEnum::published;
|
||||
$dynamicPageModel->isLocked = true;
|
||||
$dynamicPageModel->isRoot = false;
|
||||
$dynamicPageModel->saveOrFail();
|
||||
|
||||
$titleLegalNotice = "Mentions légales";
|
||||
$slugLegalNotice = Str::slug($titleLegalNotice);
|
||||
$dynamicPageModel = new DynamicPage;
|
||||
$dynamicPageModel->id_key = $slugLegalNotice;
|
||||
$dynamicPageModel->slug = $slugLegalNotice;
|
||||
$dynamicPageModel->title = $titleLegalNotice;
|
||||
$dynamicPageModel->content = [];
|
||||
$dynamicPageModel->status = PageStatusEnum::published;
|
||||
$dynamicPageModel->isLocked = true;
|
||||
$dynamicPageModel->isRoot = false;
|
||||
$dynamicPageModel->saveOrFail();
|
||||
|
||||
// Fake dynamic pages.
|
||||
DynamicPage::factory(20)->make()->each(function ($model) {
|
||||
$content = $model->content;
|
||||
// Config factories add just one depth of children.
|
||||
foreach ($model->content as $key => $value) {
|
||||
$prefix = sprintf("%s_", DynamicFieldTypes::image->name);
|
||||
if (Str::startsWith($key, $prefix)) {
|
||||
$content[$key] = FileHelper::storeFile(
|
||||
$model,
|
||||
new \SplFileInfo(\resource_path(
|
||||
'../database/factories/assets/dynamic-pages/100x100.jpg'
|
||||
))
|
||||
);
|
||||
}
|
||||
$model->content = $content;
|
||||
$model->saveOrFail();
|
||||
});
|
||||
}
|
||||
$model->content = $content;
|
||||
$model->saveOrFail();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,19 @@ class NewsSeeder extends Seeder
|
|||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$categoriesIds = NewsCategory::pluck('id');
|
||||
News::factory(10)->create()->each(function (News $news) use ($categoriesIds) {
|
||||
News::factory(10)->make()->each(function (News $news) {
|
||||
$news->picture = FileHelper::storeFile(
|
||||
$news,
|
||||
new \SplFileInfo(
|
||||
resource_path('../database/factories/assets/news/525x295.jpg')
|
||||
)
|
||||
new \SplFileInfo(resource_path(
|
||||
'../database/factories/assets/news/525x295.jpg'
|
||||
))
|
||||
);
|
||||
$news->save();
|
||||
$news->saveOrFail();
|
||||
});
|
||||
|
||||
// News relation.
|
||||
$categoriesIds = NewsCategory::pluck('id');
|
||||
News::query()->get()->map(function (News $news) use ($categoriesIds) {
|
||||
$news->categories()->attach(
|
||||
$categoriesIds->random(rand(1, 3))->all()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ return [
|
|||
'are_you_breeder_and_join_us' => 'Vous êtes éleveur de volailles ou souhaitez le devenir, et nous rejoindre ? ',
|
||||
'describe_your_project' => 'Décrivez-nous votre projet le plus précisément possible afin que nous puissions orienter votre demande vers l’interlocuteur adéquat.',
|
||||
'info_personal_data' => 'Les informations recueillies à partir de ce formulaire sont traitées par le Responsable de Traitement pour donner suite à votre demande de contact. Pour connaître vos droits, vous pouvez consulter',
|
||||
'confidentiality' => 'la Charte de confidentialité',
|
||||
'confidentiality' => 'la politique de confidentialité',
|
||||
'other_product_information' => 'Vous souhaitez une information ou avez une remarque sur nos produits ? Dirigez-vous directement sur le site de la marque concernée (rubriques Contact ou Service Consommateurs). Si la marque ou le produit ne possède pas de site web, merci d’adresser votre demande par voie postale à l’adresse du site mentionnée sur l’emballage.',
|
||||
'inputs' => [
|
||||
'breedtype' => [
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ return [
|
|||
"validation" => "validation",
|
||||
"reference" => "référence",
|
||||
"locked" => "vérouillé",
|
||||
"root" => "page racine (accueil)",
|
||||
"root" => "page racine",
|
||||
"field" => "champs",
|
||||
"key" => "clé",
|
||||
"slug" => "chemin d'accès",
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ export default function Form({
|
|||
const enumDynamicPageStatus = usePage().props.enumDynamicPageStatus as LaravelEnum;
|
||||
const dynamicPageModels = usePage().props.dynamicPageModels as DynamicPageModel[];
|
||||
const [selectedGroup, setSelectedGroup] = useState<string | null>(null);
|
||||
const isConceptor = userModel.role === enumUserRole.conceptor.value;
|
||||
|
||||
const pageConfigModels = usePage().props.pageConfigModels as Array<PageConfigModel>;
|
||||
// Models filtered based on the presence of the locale.
|
||||
|
|
@ -211,23 +212,25 @@ export default function Form({
|
|||
value={data.title}
|
||||
setData={setData}
|
||||
/>
|
||||
<EnumSelect
|
||||
name="status"
|
||||
options={enumDynamicPageStatus}
|
||||
label={str(
|
||||
useTrans("back.form_associate_to", {
|
||||
params: {
|
||||
attribute: useTrans("validation.custom.status"),
|
||||
},
|
||||
choice: 1,
|
||||
}),
|
||||
)
|
||||
.ucFirst()
|
||||
.value()}
|
||||
placeholder={`ex: ${enumDynamicPageStatus.draft.label}`}
|
||||
selected={data.status}
|
||||
setData={setData}
|
||||
/>
|
||||
{(!data?.isLocked || isConceptor) && (
|
||||
<EnumSelect
|
||||
name="status"
|
||||
options={enumDynamicPageStatus}
|
||||
label={str(
|
||||
useTrans("back.form_associate_to", {
|
||||
params: {
|
||||
attribute: useTrans("validation.custom.status"),
|
||||
},
|
||||
choice: 1,
|
||||
}),
|
||||
)
|
||||
.ucFirst()
|
||||
.value()}
|
||||
placeholder={`ex: ${enumDynamicPageStatus.draft.label}`}
|
||||
selected={data.status}
|
||||
setData={setData}
|
||||
/>
|
||||
)}
|
||||
</FieldsetWrapper>
|
||||
<FieldsetWrapper
|
||||
title={useTrans("back.form_title_page_accessibility")}
|
||||
|
|
@ -235,48 +238,54 @@ export default function Form({
|
|||
description={useTrans("back.form_subtitle_page_accessibility")}
|
||||
className="sm:grid-cols-2 gap-4"
|
||||
>
|
||||
<div className="col-span-2">
|
||||
<SimpleSwitch
|
||||
label={str(useTrans("validation.custom.root")).ucFirst().value()}
|
||||
name="isRoot"
|
||||
checked={data.isRoot}
|
||||
setData={(name, value) => {
|
||||
setSelectedGroup(null);
|
||||
setData("page_id", null);
|
||||
setData("slug", "");
|
||||
// @ts-ignore
|
||||
setData(name, value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<ModelSelect
|
||||
name="page_id"
|
||||
targetModel="dynamic_pages"
|
||||
field="title"
|
||||
label={str(
|
||||
useTrans("back.form_associate_to", {
|
||||
params: {
|
||||
attribute: useTrans("validation.custom.parent_page"),
|
||||
},
|
||||
choice: 2,
|
||||
}),
|
||||
)
|
||||
.ucFirst()
|
||||
.value()}
|
||||
placeholder="ex: "
|
||||
selected={!data.isRoot ? data.page_id : null}
|
||||
exclude={model?.id}
|
||||
required={false}
|
||||
setData={setData}
|
||||
onSelectValue={(value) => setSelectedGroup((value !== null) ? (value as DynamicPageModel).title[locale] : null)}
|
||||
disabled={data.isRoot}
|
||||
/>
|
||||
<Slugifycator
|
||||
value={!data.isRoot ? data.slug : ""}
|
||||
targetValue={data.title}
|
||||
setData={setData}
|
||||
disabled={data.isRoot}
|
||||
/>
|
||||
{isConceptor && (
|
||||
<div className="col-span-2">
|
||||
<SimpleSwitch
|
||||
label={str(useTrans("validation.custom.root")).ucFirst().value()}
|
||||
name="isRoot"
|
||||
checked={data.isRoot}
|
||||
setData={(name, value) => {
|
||||
setSelectedGroup(null);
|
||||
setData("page_id", null);
|
||||
setData("slug", "");
|
||||
// @ts-ignore
|
||||
setData(name, value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{!data?.isRoot && (
|
||||
<>
|
||||
<ModelSelect
|
||||
name="page_id"
|
||||
targetModel="dynamic_pages"
|
||||
field="title"
|
||||
label={str(
|
||||
useTrans("back.form_associate_to", {
|
||||
params: {
|
||||
attribute: useTrans("validation.custom.parent_page"),
|
||||
},
|
||||
choice: 2,
|
||||
}),
|
||||
)
|
||||
.ucFirst()
|
||||
.value()}
|
||||
placeholder="ex: "
|
||||
selected={!data.isRoot ? data.page_id : null}
|
||||
exclude={model?.id}
|
||||
required={false}
|
||||
setData={setData}
|
||||
onSelectValue={(value) => setSelectedGroup((value !== null) ? (value as DynamicPageModel).title[locale] : null)}
|
||||
disabled={data.isRoot}
|
||||
/>
|
||||
<Slugifycator
|
||||
value={!data.isRoot ? data.slug : ""}
|
||||
targetValue={data.title}
|
||||
setData={setData}
|
||||
disabled={data.isRoot}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className="col-span-1 md:col-span-2">
|
||||
<GoToFrontView
|
||||
modelName={useTrans(`models.classes.${modelName}`, { choice: 1 })}
|
||||
|
|
@ -314,7 +323,7 @@ export default function Form({
|
|||
selected={data.config_id}
|
||||
setData={setData}
|
||||
/>
|
||||
{userModel.role === enumUserRole.conceptor.value &&
|
||||
{isConceptor &&
|
||||
Number(data.config_id) !== defaultConfigId && (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
|
|
@ -390,7 +399,7 @@ export default function Form({
|
|||
/>
|
||||
)}
|
||||
</FieldsetWrapper>
|
||||
{userModel.role === enumUserRole.conceptor.value && (
|
||||
{isConceptor && (
|
||||
<FieldsetWrapper
|
||||
className="gap-4"
|
||||
title={useTrans("back.form_title_isLocked")}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export default function Default({ status }: { status: number }) {
|
|||
</Link>
|
||||
</Button>
|
||||
<Button variant="outline" asChild>
|
||||
<a href={route("front.dynamic-pages.accueil." + locale)}>
|
||||
<a href="/">
|
||||
{useTrans("back.your_website")}
|
||||
</a>
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<link rel="manifest" href="{{ asset('/favicon-back/manifest.json') }}">
|
||||
|
||||
<!-- Scripts -->
|
||||
@routes(nonce: $nonce)
|
||||
@routes(nonce: $nonce ?? '')
|
||||
@if (app()->hasDebugModeEnabled())
|
||||
@viteReactRefresh
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@if ($breadcrumbs->isNotEmpty() && request()->route()->getName() !== 'front.dynamic-pages.accueil.' . app()->getLocale())
|
||||
@if ($breadcrumbs->isNotEmpty() && request()->path() !== "/")
|
||||
<div class="breadcrumbs breadcrumbs_base_margined fw">
|
||||
<div class="breadcrumbs__wrapper wrapper">
|
||||
@foreach ($breadcrumbs as $breadcrumb)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
'content' => $dynamicPageModel->content,
|
||||
])
|
||||
@else
|
||||
{!! $dynamicPageModel->content !!}
|
||||
@if (!is_array($dynamicPageModel->content))
|
||||
{!! $dynamicPageModel->content !!}
|
||||
@endif
|
||||
@endif
|
||||
<p>created_at (Date de création): {{ $dynamicPageModel->created_at }}</p>
|
||||
<p>updated_at (Date de mise à jour): {{ $dynamicPageModel->updated_at }}</p>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,5 @@
|
|||
@section('content')
|
||||
<h1>{{ sprintf("%s - %s", $status, trans("errors.$status.title")) }}</h1>
|
||||
<p>{{ trans("errors.$status.description") }}</p>
|
||||
<a href="{{ \App\Helpers\RouteHelper::routeNameChecker('front.dynamic-pages.accueil') }}">
|
||||
{{ trans("front.back_to_homepage") }}
|
||||
</a>
|
||||
<a href="/">{{ trans("front.back_to_homepage") }}</a>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -53,57 +53,59 @@
|
|||
@endif
|
||||
|
||||
{{-- TEXT BLOCK --}}
|
||||
@php
|
||||
$blocks = [
|
||||
'hide_block' => false,
|
||||
'title' => $dynamicPageModel->content['list_section_together'][0]['string_title'],
|
||||
'subtitle' => [
|
||||
'text' => $dynamicPageModel->content['list_section_together'][0]['string_subtitle'],
|
||||
'cursive' => true,
|
||||
],
|
||||
'bg' => true,
|
||||
'list' => [],
|
||||
];
|
||||
foreach($dynamicPageModel->content['list_section_together'][0]['list_content_block'] as $keyContent => $content) {
|
||||
$positionMedium = intval($content['list_medium'][0]['position_medium']);
|
||||
array_push($blocks['list'], [
|
||||
'title' => $content['string_title'] ?? null,
|
||||
'text' => $content['wysiwyg_description'],
|
||||
'quote' => 0,
|
||||
'swap_position' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value()
|
||||
? true
|
||||
: $positionMedium === \App\Enums\ElementPositionEnum::showright->value(),
|
||||
'in_row' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value(),
|
||||
'floated' => 0,
|
||||
'align_center' => 1,
|
||||
'borders_desktop' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
@if (isset($dynamicPageModel->content['list_section_together']))
|
||||
@php
|
||||
$blocks = [
|
||||
'hide_block' => false,
|
||||
'title' => $dynamicPageModel->content['list_section_together'][0]['string_title'],
|
||||
'subtitle' => [
|
||||
'text' => $dynamicPageModel->content['list_section_together'][0]['string_subtitle'],
|
||||
'cursive' => true,
|
||||
],
|
||||
'borders_mobile' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'image' => [
|
||||
[
|
||||
'url' => $content['list_medium'][0]['image_picture'],
|
||||
'alt' => $content['list_medium'][0]['string_alt'],
|
||||
'bg' => true,
|
||||
'list' => [],
|
||||
];
|
||||
foreach($dynamicPageModel->content['list_section_together'][0]['list_content_block'] as $keyContent => $content) {
|
||||
$positionMedium = intval($content['list_medium'][0]['position_medium']);
|
||||
array_push($blocks['list'], [
|
||||
'title' => $content['string_title'] ?? null,
|
||||
'text' => $content['wysiwyg_description'],
|
||||
'quote' => 0,
|
||||
'swap_position' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value()
|
||||
? true
|
||||
: $positionMedium === \App\Enums\ElementPositionEnum::showright->value(),
|
||||
'in_row' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value(),
|
||||
'floated' => 0,
|
||||
'align_center' => 1,
|
||||
'borders_desktop' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
],
|
||||
'button' => [
|
||||
'title' => $content['list_button'][0]['string_label'],
|
||||
'url' => $content['list_button'][0]['url_link'],
|
||||
'target' => '_blank',
|
||||
],
|
||||
'button_icon' => 'btn__icon_arrow-right',
|
||||
]);
|
||||
}
|
||||
@endphp
|
||||
<x-front.text-block :textBlock="$blocks" />
|
||||
'borders_mobile' => [
|
||||
'left' => true,
|
||||
'right' => true,
|
||||
'top' => true,
|
||||
'bottom' => true,
|
||||
],
|
||||
'image' => [
|
||||
[
|
||||
'url' => $content['list_medium'][0]['image_picture'],
|
||||
'alt' => $content['list_medium'][0]['string_alt'],
|
||||
],
|
||||
],
|
||||
'button' => [
|
||||
'title' => $content['list_button'][0]['string_label'],
|
||||
'url' => $content['list_button'][0]['url_link'],
|
||||
'target' => '_blank',
|
||||
],
|
||||
'button_icon' => 'btn__icon_arrow-right',
|
||||
]);
|
||||
}
|
||||
@endphp
|
||||
<x-front.text-block :textBlock="$blocks" />
|
||||
@endif
|
||||
|
||||
{{-- BRANDS --}}
|
||||
@php
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $currentLocale = app()->getLocale();
|
|||
$supportedLocales = LaravelLocalization::getSupportedLanguagesKeys();
|
||||
$pageHome = DynamicPage::getModelsCached()
|
||||
->where('status', PageStatusEnum::published)
|
||||
->where('id_key', 'accueil')
|
||||
->where('isRoot', true)
|
||||
->first();
|
||||
|
||||
// * DYNAMIC PAGES.
|
||||
|
|
@ -24,7 +24,7 @@ DynamicPage::getModelsCached()->map(function (DynamicPage $dynamicPageModel) use
|
|||
function (Generator $trail) use ($currentLocale, $dynamicPageModel, $pageHome) {
|
||||
if (!is_null($dynamicPageModel->page_id)) {
|
||||
$trail->parent(sprintf("front.dynamic-pages.%s.%s", $dynamicPageModel->parentPage->id_key, $currentLocale));
|
||||
} elseif ($dynamicPageModel->id_key !== $pageHome->id_key) {
|
||||
} elseif (isset($pageHome) && $dynamicPageModel->id_key !== $pageHome->id_key) {
|
||||
$trail->parent(sprintf("front.dynamic-pages.%s.%s", $pageHome->id_key, $currentLocale));
|
||||
}
|
||||
$trail->push($dynamicPageModel->title, RouteHelper::routeNameChecker(sprintf("front.dynamic-pages.%s", $dynamicPageModel->id_key)));
|
||||
|
|
@ -61,7 +61,7 @@ Breadcrumbs::for('front.contact.show', function (Generator $trail) {
|
|||
// * SEARCH INDEX.
|
||||
Breadcrumbs::for('front.search', function (Generator $trail) use ($pageHome, $currentLocale) {
|
||||
if ($pageHome) {
|
||||
$trail->parent("front.dynamic-pages.accueil.$currentLocale");
|
||||
$trail->parent(sprintf("front.dynamic-pages.%s.%s", $pageHome->id_key, $currentLocale));
|
||||
}
|
||||
$trail->push(
|
||||
Str::of(trans('front.search.trans'))->ucfirst(),
|
||||
|
|
@ -89,6 +89,6 @@ Breadcrumbs::for('front.news.show', function (Generator $trail) use ($currentLoc
|
|||
// Need it for the search page.
|
||||
Breadcrumbs::for('front.documents.show', function (Generator $trail) use ($pageHome, $currentLocale) {
|
||||
if ($pageHome) {
|
||||
$trail->parent("front.dynamic-pages.accueil.$currentLocale");
|
||||
$trail->parent(sprintf("front.dynamic-pages.%s.%s", $pageHome->id_key, $currentLocale));
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue