179 lines
6.2 KiB
PHP
179 lines
6.2 KiB
PHP
<?php
|
|
|
|
use App\Enums\DynamicPages\PageStatusEnum;
|
|
use App\Enums\Contact\ContactFormType;
|
|
use App\Helpers\RouteHelper;
|
|
use App\Models\DynamicPage;
|
|
use App\Models\News;
|
|
use Diglactic\Breadcrumbs\Breadcrumbs;
|
|
use Diglactic\Breadcrumbs\Generator;
|
|
use Illuminate\Support\Str;
|
|
|
|
// * HOMEPAGE.
|
|
Breadcrumbs::for('front.homepage', function (Generator $trail) {
|
|
$trail->push(
|
|
Str::ucfirst(trans('front.homepage')),
|
|
route('front.homepage')
|
|
);
|
|
});
|
|
|
|
|
|
// * CONTACT PAGE
|
|
Breadcrumbs::for('front.contact.index', function (Generator $trail) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push(
|
|
Str::of(trans('front.contact.index'))->ucfirst(),
|
|
route('front.contact.index')
|
|
);
|
|
});
|
|
|
|
Breadcrumbs::for('front.contact.show', function (Generator $trail) {
|
|
$trail->parent('front.contact.index');
|
|
$slug = \request()->route()->parameters['slug'];
|
|
$enumType = collect(ContactFormType::all())->first(function ($enum) use ($slug) {
|
|
return $enum->slug() === $slug;
|
|
});
|
|
if ($slug) {
|
|
$trail->push(
|
|
Str::of(trans($enumType->label()))->ucfirst()
|
|
);
|
|
}
|
|
});
|
|
|
|
// * SEARCH PAGE
|
|
Breadcrumbs::for('front.search', function (Generator $trail) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push(
|
|
Str::of(trans('front.search'))->ucfirst(),
|
|
route('front.search')
|
|
);
|
|
});
|
|
|
|
// * ESPACE PRESSE.
|
|
$pageEspacePresse = DynamicPage::getDynamicPages()->where('status', PageStatusEnum::published)->where('id_key', 'espace-presse')->first();
|
|
if ($pageEspacePresse) {
|
|
Breadcrumbs::for('front.dynamic-pages.espace-presse.fr', function (Generator $trail) use ($pageEspacePresse) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageEspacePresse->title);
|
|
});
|
|
Breadcrumbs::for('front.dynamic-pages.espace-presse.en', function (Generator $trail) use ($pageEspacePresse) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageEspacePresse->title);
|
|
});
|
|
}
|
|
|
|
// * ENGAGEMENTS PAGES.
|
|
Breadcrumbs::for('front.nos-engagements', function (Generator $trail) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push(
|
|
Str::of(trans('front.nos-engagements'))->ucfirst()->plural(),
|
|
route('front.nos-engagements')
|
|
);
|
|
});
|
|
Breadcrumbs::for('front.elever-durablement', function (Generator $trail) {
|
|
$trail->parent('front.nos-engagements');
|
|
$trail->push(
|
|
Str::of(trans('front.elever-durablement'))->ucfirst(),
|
|
route('front.elever-durablement')
|
|
);
|
|
});
|
|
Breadcrumbs::for('front.mieux-vivre-ensemble', function (Generator $trail) {
|
|
$trail->parent('front.nos-engagements');
|
|
$trail->push(
|
|
Str::of(trans('front.mieux-vivre-ensemble'))->ucfirst(),
|
|
route('front.mieux-vivre-ensemble')
|
|
);
|
|
});
|
|
Breadcrumbs::for('front.respecter-la-terre', function (Generator $trail) {
|
|
$trail->parent('front.nos-engagements');
|
|
$trail->push(
|
|
Str::of(trans('front.respecter-la-terre'))->ucfirst(),
|
|
route('front.respecter-la-terre')
|
|
);
|
|
});
|
|
Breadcrumbs::for('front.bien-nourrir', function (Generator $trail) {
|
|
$trail->parent('front.nos-engagements');
|
|
$trail->push(
|
|
Str::of(trans('front.bien-nourrir'))->ucfirst(),
|
|
route('front.bien-nourrir')
|
|
);
|
|
});
|
|
|
|
// * KNOW US PAGES.
|
|
$pageKnowUs = DynamicPage::getDynamicPages()
|
|
->where('status', PageStatusEnum::published)
|
|
->where('id_key', 'nous-connaitre')
|
|
->first();
|
|
if ($pageKnowUs) {
|
|
Breadcrumbs::for('front.dynamic-pages.nous-connaitre.fr', function (Generator $trail) use ($pageKnowUs) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageKnowUs->title);
|
|
});
|
|
Breadcrumbs::for('front.dynamic-pages.nous-connaitre.en', function (Generator $trail) use ($pageKnowUs) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageKnowUs->title);
|
|
});
|
|
}
|
|
|
|
// * OUR BRANDS PAGE.
|
|
$pageNosMarques = DynamicPage::getDynamicPages()->where('status', PageStatusEnum::published)->where('id_key', 'nos-marques')->first();
|
|
if ($pageNosMarques) {
|
|
Breadcrumbs::for('front.dynamic-pages.nos-marques.fr', function (Generator $trail) use ($pageNosMarques) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNosMarques->title);
|
|
});
|
|
Breadcrumbs::for('front.dynamic-pages.nos-marques.en', function (Generator $trail) use ($pageNosMarques) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNosMarques->title);
|
|
});
|
|
}
|
|
|
|
// * JOIN US.
|
|
$pageNousRejoindre = DynamicPage::getDynamicPages()->where('status', PageStatusEnum::published)->where('id_key', 'nous-rejoindre')->first();
|
|
if ($pageNousRejoindre) {
|
|
Breadcrumbs::for('front.dynamic-pages.nous-rejoindre.fr', function (Generator $trail) use ($pageNousRejoindre) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNousRejoindre->title);
|
|
});
|
|
Breadcrumbs::for('front.dynamic-pages.nous-rejoindre.en', function (Generator $trail) use ($pageNousRejoindre) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNousRejoindre->title);
|
|
});
|
|
}
|
|
|
|
// * OUR JOBS.
|
|
$pageNosMetiers = DynamicPage::getDynamicPages()->where('status', PageStatusEnum::published)->where('id_key', 'nos-metiers')->first();
|
|
if ($pageNosMetiers) {
|
|
Breadcrumbs::for('front.dynamic-pages.nos-metiers.fr', function (Generator $trail) use ($pageNosMetiers) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNosMetiers->title);
|
|
});
|
|
Breadcrumbs::for('front.dynamic-pages.nos-metiers.en', function (Generator $trail) use ($pageNosMetiers) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push($pageNosMetiers->title);
|
|
});
|
|
}
|
|
|
|
// * NEWS.
|
|
Breadcrumbs::for('front.news.index', function (Generator $trail) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push(
|
|
Str::of(trans('front.news.index'))->ucfirst(),
|
|
route('front.news.index')
|
|
);
|
|
});
|
|
Breadcrumbs::for('front.news.show', function (Generator $trail) {
|
|
$trail->parent('front.news.index');
|
|
$trail->push(
|
|
Str::of(request()->model->title)->ucfirst()
|
|
);
|
|
});
|
|
|
|
// * FINANCE.
|
|
Breadcrumbs::for('front.finance', function (Generator $trail) {
|
|
$trail->parent('front.homepage');
|
|
$trail->push(
|
|
Str::of(trans('front.finance'))->ucfirst(),
|
|
route('front.finance')
|
|
);
|
|
});
|