From 7df1e8345dc7c88ec73222e371e053b70e0173cb Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 23 Jul 2021 13:26:42 +0200 Subject: [PATCH] app/Models/Item.php: add getRouteKeyName() --- app/Models/Item.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Models/Item.php b/app/Models/Item.php index 0c79d53..8b56cc5 100644 --- a/app/Models/Item.php +++ b/app/Models/Item.php @@ -32,6 +32,16 @@ class Item extends Model }); } + /** + * Get the route key for the model. + * + * @return string + */ + public function getRouteKeyName() + { + return 'slug'; + } + public function recipe() { return $this->belongsTo(Recipe::class, 'id');