validated())); } /** * Display the specified resource. */ public function show(Category $category) { return new CategoryResource($category); } /** * Update the specified resource in storage. */ public function update(UpdateCategoryRequest $request, Category $category) { $category->update($request->validated()); return new CategoryResource($category); } /** * Remove the specified resource from storage. */ public function destroy(Category $category) { $user = auth()->user(); if (! $user || $user->email !== config('app.admin_email')) { return response()->json(['message' => 'Forbidden'], 403); } $category->delete(); return response()->noContent(); } }