public function tag($id) { $categories = Category::all(); $tag = tag::find($id); $products = $tag->products; return view('store.tag', compact('categories', 'products', 'tag')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $tag = tag::find($id); if (!$tag) { return $this->respondNotFound('tag does not exist'); } return $this->respond(['data' => $this->tagTransformer->transform($tag)]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $tag = tag::find($id); $tag->delete(); return redirect('tags'); }