data = $data; } /** * Execute the job. * * @return void */ public function handle() { $token = config('app.task_token'); $url = env('APP_TASK_URL')."/api/tp/task/databases"; $client = new Client(); $header = [ 'APPTOKEN' => $token, 'Content-Type' => 'application/json' ]; $options = [ RequestOptions::TIMEOUT => 3, RequestOptions::HTTP_ERRORS => false, RequestOptions::HEADERS => $header, RequestOptions::QUERY => $this->data, ]; $response = $client->post($url, $options); $content = $response->getBody(); $res = json_decode($content, true); if ($res && isset($res['code'])) { if ($res['code']) { throw new \Exception($res['message']); } } return true; } }