Merge branch 'feature/HarimWebService' into 'develop'

create harim services

See merge request witelgroup/rms_v2!149
This commit is contained in:
2025-08-05 06:25:30 +00:00

View File

@@ -0,0 +1,42 @@
<?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();
}
}