/** * Display all products in $category Category * * @param $id * @return Response */ public function index($id) { $category = Category::withTrashed()->findOrFail($id); $products = $category->products()->withTrashed()->get(); return view('products.index', compact('products', 'category')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $categories = Category::withTrashed()->get()->linkNodes(); return view('categories.index', compact('categories')); }