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) ->throw() ->withoutVerifying() ->post($this->url) ->json(); } private function makeInputParameters(): string { $inputData = array( "username" => $this->username, "password" => $this->password, "day" => today(), "minMileage" => 10, ); return json_encode($inputData); } }