public function category($id) { $categories = Category::all(); $category = Category::find($id); $books = $category->books()->where('published', 1)->get(); return view('store.category', compact('category', 'categories', 'books')); }
public function destroy($id) { Category::find($id)->delete(); return redirect()->route('admin.categories.index'); }