change some part of code
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services\CMMS;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -13,8 +14,6 @@ class DailyMovingMachinesService
|
||||
protected string $password;
|
||||
protected string $channelName;
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('cmms_web_services.CHECK_ACTIVITY.url');
|
||||
@@ -26,12 +25,11 @@ class DailyMovingMachinesService
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function run(): array
|
||||
public function run(): Collection
|
||||
{
|
||||
try {
|
||||
return $this->sendRequest();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return collect( $this->sendRequest());
|
||||
} catch (Exception $e) {
|
||||
Log::channel($this->channelName)
|
||||
->error(get_class($this),
|
||||
[
|
||||
@@ -56,13 +54,11 @@ class DailyMovingMachinesService
|
||||
|
||||
private function makeInputParameters(): string
|
||||
{
|
||||
$inputData = array(
|
||||
"username" => $this->username,
|
||||
"password" => $this->password,
|
||||
"day" => today(),
|
||||
"minMileage" => 10,
|
||||
);
|
||||
|
||||
return json_encode($inputData);
|
||||
return json_encode([
|
||||
"username" => $this->username,
|
||||
"password" => $this->password,
|
||||
"day" => today(),
|
||||
"minMileage" => 10,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user