change some part of code

This commit is contained in:
2025-11-15 16:08:06 +03:30
parent 69430cf7bc
commit a54345983d
8 changed files with 60 additions and 68 deletions

View File

@@ -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,
]);
}
}