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:
parent
b989a45864
commit
6cfa8d8e27
1 changed files with 2 additions and 2 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue