create job for road observed problems
This commit is contained in:
50
app/Jobs/SendRoadObservationToNikarayan.php
Normal file
50
app/Jobs/SendRoadObservationToNikarayan.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SoapClient;
|
||||
|
||||
class SendRoadObservationToNikarayan implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct(private RoadObserved $roadObserved){}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
try {
|
||||
$url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
|
||||
|
||||
$array = array(
|
||||
'strUserName' => 'vaytelrop',
|
||||
'strPassword' => 'VaYtelROP*2024',
|
||||
'strAutoID' => $this->roadObserved->fk_RegisteredEventMessage,
|
||||
'strStateID' => '2',
|
||||
'strDescription' => 'گزارشات تایید شده از تاریخ 1 فروردین 1403 تا 14 مهر 1403',
|
||||
'strRMSDateAndTime' => $this->roadObserved->updated_at
|
||||
);
|
||||
|
||||
$soapClient = new SoapClient($url);
|
||||
|
||||
$soapClient->UpdateInfo_RoadObservedProblems($array);
|
||||
}
|
||||
catch (\Exception $exception){
|
||||
Log::channel('road_observation_problem')->error($exception->getMessage(), [
|
||||
'roadObserved' => $this->roadObserved,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user