108 lines
3.7 KiB
PHP
108 lines
3.7 KiB
PHP
<?php
|
|
|
|
use App\Models\Concept;
|
|
use App\Models\News;
|
|
use App\Models\Product;
|
|
use App\Models\Recipe;
|
|
use App\Models\StaticPage;
|
|
use Diglactic\Breadcrumbs\Breadcrumbs;
|
|
use Diglactic\Breadcrumbs\Generator;
|
|
use Illuminate\Support\Str;
|
|
|
|
// * HOME
|
|
Breadcrumbs::for(sprintf('%s.home', app()->currentLocale()), function (Generator $trail) {
|
|
$trail->push(Str::ucfirst(trans('homepage')), route('home'));
|
|
});
|
|
|
|
// * LEGALS
|
|
Breadcrumbs::for(sprintf('%s.legals', app()->currentLocale()), function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('legals'));
|
|
});
|
|
|
|
// * PRIVACY
|
|
Breadcrumbs::for(sprintf('%s.privacy', app()->currentLocale()), function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('privacy'));
|
|
});
|
|
|
|
// * STORE FINDER
|
|
Breadcrumbs::for(
|
|
sprintf('%s.storefinder.index', app()->currentLocale()),
|
|
function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('storefinder.index'));
|
|
}
|
|
);
|
|
|
|
// * CONTACT
|
|
Breadcrumbs::for(
|
|
sprintf('%s.contact-form', app()->currentLocale()),
|
|
function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('contact-form'));
|
|
}
|
|
);
|
|
|
|
// * RECIPES
|
|
Breadcrumbs::for(
|
|
sprintf('%s.recipes.index', app()->currentLocale()),
|
|
function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('recipes.index'));
|
|
}
|
|
);
|
|
Breadcrumbs::for(
|
|
sprintf('%s.recipe.show', app()->currentLocale()),
|
|
function (Generator $trail, Recipe|null $publishedRecipe = null) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
if (!is_null($publishedRecipe)) {
|
|
$trail->push($publishedRecipe->name, route('recipe.show', $publishedRecipe));
|
|
}
|
|
}
|
|
);
|
|
|
|
// * PRODUCTS
|
|
Breadcrumbs::for(
|
|
sprintf('%s.products.index', app()->currentLocale()),
|
|
function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('products.index'));
|
|
}
|
|
);
|
|
Breadcrumbs::for(
|
|
sprintf('%s.product.show', app()->currentLocale()),
|
|
function (Generator $trail, Product|null $publishedProduct = null) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
if (!is_null($publishedProduct)) {
|
|
$trail->push($publishedProduct->label, route('product.show', $publishedProduct));
|
|
}
|
|
}
|
|
);
|
|
|
|
// * NEWS
|
|
Breadcrumbs::for(
|
|
sprintf('%s.news.index', app()->currentLocale()),
|
|
function (Generator $trail, StaticPage $static_page) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($static_page->title, route('news.index'));
|
|
}
|
|
);
|
|
Breadcrumbs::for(
|
|
sprintf('%s.news.show', app()->currentLocale()),
|
|
function (Generator $trail, News|null $publishedNews = null) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
if (!is_null($publishedNews)) {
|
|
$trail->push($publishedNews->title, route('news.show', $publishedNews));
|
|
}
|
|
}
|
|
);
|
|
|
|
// * CONCEPTS
|
|
Breadcrumbs::for(
|
|
sprintf('%s.concept.show', app()->currentLocale()),
|
|
function (Generator $trail, Concept $concept) {
|
|
$trail->parent(sprintf('%s.home', app()->currentLocale()));
|
|
$trail->push($concept->name, route('concept.show', $concept));
|
|
}
|
|
);
|