items()->find(request('item')); try { $item->takeItem(); } catch (\Exception $e) { return back()->withErrors( Lang::getFromJson('This item is already taken') ); } RefreshPage::dispatch($item); return redirect('home'); } /** * User return an item * Trigger an event: ReturnItem * * @param Request $request Form data * * @return View home */ public function delete(Request $request) { $item = User::loggedIn()->items()->find(request('item')); try { $item->returnItem(); } catch (\Exception $e) { return back()->withErrors( Lang::getFromJson("You cannot return an item that is not with you") ); } RefreshPage::dispatch($item); ReturnItem::dispatch($item); return redirect('home'); } }