api23GateTokenService = $api23GateTokenService; $this->itemUrlScrapService = $itemUrlScrapService; } public function store(Request $request) { $result = $this->api23GateTokenService->getToken($request->header('Api23Key')); if ($result['error']) { return response()->json($result['message'], 401); } $request = json_decode($request->getContent(), true); try { $response = $this->itemUrlScrapService->execute($result['data'], $request); return response()->json($response); } catch (Exception $e) { return response()->json('Unauthorized', 401); } } }