From 92f901e3a502aabe2fc01679e19279b86fd9b66c Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Sun, 16 Sep 2018 20:31:27 -0300 Subject: [PATCH] Including a findOrFail to Edit ITEM --- app/Http/Controllers/ItemController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index d6a1abd..b9f94c3 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -49,7 +49,7 @@ class ItemController extends Controller public function patch(Request $request) { $request->validate(['item' => 'required', 'name' => 'required']); - $item = User::find(\Auth::id())->items()->find(request('item')); + $item = User::findOrFail(\Auth::id())->items()->find(request('item')); $item->name = request('name'); $item->save(); return redirect('item/'.request('item'));