mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-23 20:10:52 +00:00
Including a findOrFail to Edit ITEM
This commit is contained in:
parent
4b9ac0c133
commit
92f901e3a5
@ -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'));
|
||||
|
Loading…
Reference in New Issue
Block a user