public function delete(Request $request, $publisherId) { if (!$this->hasAccess($request)) { return Response()->json(['error' => 'Access denied.'], 500); } if (Gate::denies('admin')) { return Response()->json(['error' => 'Method not allowed'], 403); } try { $publisher = Publisher::findOrFail($publisherId); $data = $publisher->delete(); } catch (Exception $e) { $data = ['error' => 'User not found', 'message' => $e->getMessage()]; } return ['data' => $publisher ? true : null]; }