Files
backend/app/Services/Cartables/Harim/FetchNewRequestsService.php
2025-08-05 09:08:20 +03:30

42 lines
1.0 KiB
PHP

<?php
namespace App\Services\Cartables\Harim;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class FetchNewRequestsService
{
protected string $url;
protected string $channelName;
protected string $username;
protected string $password;
public function __construct()
{
$this->url = config('cmms_web_services.MACHINE_INFO.url');
$this->username = config('cmms_web_services.MACHINE_INFO.ViewName');
$this->password = config('cmms_web_services.MACHINE_INFO.password');
}
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()
{
return Http::post($this->url, [])->json();
}
}