mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-29 01:14:04 +00:00
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace App\Classes\Modules\Orders\ControllersLogic;
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Orders\Services\ListsOrderTracking;
|
|
use App\Http\Resources\OrderTrackingResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
class ListOrderTrackingLogic extends AbstractControllerLogic
|
|
{
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Order Tracking',
|
|
'message' => 'You have successfully retrieved order tracking info'
|
|
];
|
|
}
|
|
|
|
/** @var ListsOrderTracking */
|
|
private $listsOrderTracking;
|
|
|
|
/**
|
|
* ListOrderTrackingLogic constructor.
|
|
* @param ListsOrderTracking $listsOrderTracking
|
|
*/
|
|
public function __construct(ListsOrderTracking $listsOrderTracking)
|
|
{
|
|
$this->listsOrderTracking = $listsOrderTracking;
|
|
}
|
|
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$query = $this->listsOrderTracking->execute($this->listsOrderTracking->deserializeFilters($request->input('filters')));
|
|
|
|
$filters = json_decode($request->input('filters'), true);
|
|
$trackingNo = $filters['tracking_no'];
|
|
if ($trackingNo) {
|
|
Artisan::call('process-yd-by-traking-no-data-command', [
|
|
'trackingNo' => $trackingNo
|
|
]);
|
|
}
|
|
|
|
return $this->collectionResponse(OrderTrackingResource::collection($query));
|
|
}
|
|
}
|