page = $pageRepo; } public function handleRequest(Request $request) { $path = explode('/', $request->path()); switch ($path[0]) { case 'page': $body = json_decode($request->getContent()); $result = $this->page->delete($body); return response()->json($result)->header('Content-Type', 'application/json'); break; } } }