mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Jobs\Processors;
|
|
|
|
use App\Classes\Modules\Jobs\Services\FetchesJobResult;
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
class FetchesJobResultProcessor
|
|
{
|
|
/** @var FetchesJobResult */
|
|
private $fetchesJobResult;
|
|
|
|
|
|
/**
|
|
* FetchesJobResultProcessor constructor.
|
|
* @param FetchesJobResult $fetchesJobResult
|
|
*/
|
|
public function __construct(FetchesJobResult $fetchesJobResult)
|
|
{
|
|
$this->fetchesJobResult = $fetchesJobResult;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return Model
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\JobResourceNotFoundException
|
|
* @throws \App\Classes\Exceptions\ResourceNotFoundException
|
|
*/
|
|
public function execute(Request $request){
|
|
|
|
$res1 = $this->fetchesJobResult->execute(['job_id' => $request->route('job_id')]);
|
|
|
|
if(!$res1->result){
|
|
$res2 = $this->fetchesJobResult->execute(['request_signature' => $res1->request_signature, 'result_not_null' => true, 'order_by_id_desc' => true]);
|
|
return $res2;
|
|
}
|
|
|
|
return $res1;
|
|
}
|
|
}
|