authorize('viewAny', Category::class); return View::make('categories.index', ['categories' => Category::all()]); } public function create() { $this->authorize('create', Category::class); return View::make('categories.create'); } public function store(CategoryRequest $request) { $this->authorize('create', Category::class); Category::create($request->validated()); return Redirect::route('categories.index'); } public function show(Category $category) { $this->authorize('view', $category); return View::make('categories.show', ['category' => $category]); } public function edit(Category $category) { $this->authorize('update', $category); return View::make('categories.edit', ['category' => $category]); } public function update(CategoryRequest $request, Category $category) { $this->authorize('update', $category); $category->update($request->validated()); return Redirect::route('categories.index'); } public function destroy(Category $category) { $this->authorize('delete', $category); $category->delete(); return response()->json(); } }