/** * Display a single item * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // get item instance from database with associated tags. Send 404 if Item // doesn't exit or if user presses back button after deleting. $item = myCloset\Item::where('id', $id)->with('tags')->firstOrFail(); // confirm item owner if (Auth::user()->id == $item->user_id) { return view('items.edit')->with(['item' => $item]); } else { Session::flash('flash_message', 'You are not authorized to view this item.'); return Redirect::to('/items'); } }