url = config('cmms_web_services.CHECK_ACTIVITY.url'); $this->password = config('cmms_web_services.CHECK_ACTIVITY.password'); $this->username = config('cmms_web_services.CHECK_ACTIVITY.username'); $this->channelName = 'daily_moving_machine'; } /** * @throws Exception */ public function run(): array { try { return $this->sendRequest(); } catch (Exception $e) { Log::channel($this->channelName) ->error(get_class($this), [ 'message' => $e->getMessage(), ] ); throw $e; } } public function sendRequest(): array { $inputData = $this->makeInputParameters(); return Http::withBody($inputData) ->timeout(120) ->throw() ->withoutVerifying() ->post($this->url) ->json(); } private function makeInputParameters(): string { $day = Carbon::yesterday()->toDateString(); return json_encode([ "username" => $this->username, "password" => $this->password, "day" => $day, "minMileage" => 10, ]); } }