create nikarayan fault model

This commit is contained in:
2025-09-08 11:16:24 +03:30
parent 76b0fbf565
commit dbd6c89345
5 changed files with 88 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Jobs;
use App\Models\NikarayanFault;
use App\Models\RoadObserved;
use App\Services\NikarayanService;
use Illuminate\Bus\Queueable;
@@ -11,6 +12,7 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Http\Request;
use Illuminate\Queue\SerializesModels;
use SoapFault;
use Throwable;
class UpdateRoadObservedInfoByNikarayanJob implements ShouldQueue
{
@@ -27,8 +29,19 @@ class UpdateRoadObservedInfoByNikarayanJob implements ShouldQueue
* Execute the job.
* @throws SoapFault
*/
public function handle(NikarayanService $nikarayanService): void
public function handle(NikarayanService $nikarayanService)
{
$nikarayanService->updateRoadObservedInfoByNikarayan($this->request, $this->roadObserved, $this->files);
return $nikarayanService->updateRoadObservedInfoByNikarayan($this->request, $this->roadObserved, $this->files);
}
/**
* Handle a job failure.
*/
public function failed(?Throwable $exception): void
{
NikarayanFault::query()->create([
'road_observed_id' => $this->roadObserved->id,
'response' => $exception->getMessage(),
]);
}
}