items()->find(request('item')); $item->used_by = \Auth::id(); $item->save(); return redirect('home'); } public function delete(Request $request) { $item = User::find(\Auth::id())->items()->find(request('item')); $waiting_id = $item->waiting_user_id; $item->used_by = null; $item->waiting_user_id = null; $item->save(); //Send e-mail to waiting user if ($waiting_id) { $user = User::find($waiting_id); \Mail::to($user)->send( new ItemAvailable($user->name, $item) ); } return redirect('home'); } }