Merge branch 'breadcrumb' into 'develop'

fix: 🐛 add a condition for nullable models when laravel does not resolve them

See merge request ldc-web/projets/nature-and-respect!70
This commit is contained in:
noah.lancien 2025-07-18 15:05:23 +00:00
commit b32f19fdb9

View file

@ -90,9 +90,11 @@ Breadcrumbs::for(
);
Breadcrumbs::for(
sprintf('%s.news.show', app()->currentLocale()),
function (Generator $trail, News $publishedNews) {
function (Generator $trail, News|null $publishedNews = null) {
$trail->parent(sprintf('%s.home', app()->currentLocale()));
$trail->push($publishedNews->title, route('news.show', $publishedNews));
if (!is_null($publishedNews)) {
$trail->push($publishedNews->title, route('news.show', $publishedNews));
}
}
);