fix(breadcrumbs): handle missing product and recipe gracefully

Return early instead of throwing exceptions for missing product or recipe
during breadcrumb generation to improve user experience.
This commit is contained in:
Jérémy Munsch 2026-10-19 14:39:04 +02:00
parent b989a45864
commit 6cfa8d8e27
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4

View file

@ -28,7 +28,7 @@ Breadcrumbs::for('back.products.edit', function (Generator $trail) {
$product = request()->route('product');
if (! $product instanceof Product) {
throw new \InvalidArgumentException('Product not found for breadcrumb generation.');
return;
}
$trail->parent('back.products.index');
@ -63,7 +63,7 @@ Breadcrumbs::for('back.recipes.edit', function (Generator $trail) {
$recipe = request()->route('recipe');
if (! $recipe instanceof Recipe) {
throw new \InvalidArgumentException('Recipe not found for breadcrumb generation.');
return;
}
$trail->parent('back.recipes.index');