mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
e7c0e17ee4
# Conflicts: # app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php # app/Classes/ValueObjects/Constants/TransactionType.php # routes/api.php # routes/web.php
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace App\Classes\Modules\Orders\ControllersLogic;
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Orders\Services\ListsOrders;
|
|
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
|
use App\Classes\ValueObjects\Constants\OrderType;
|
|
use App\Http\Resources\OrderV2Resource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListOrdersV2Logic extends AbstractControllerLogic
|
|
{
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved Orders',
|
|
'message' => 'You have successfully retrieved a list of Orders'
|
|
];
|
|
}
|
|
|
|
/** @var CanListOrders */
|
|
private $canListOrders;
|
|
|
|
/** @var ListsOrders */
|
|
private $listsOrders;
|
|
|
|
/**
|
|
* ListOrdersLogic constructor.
|
|
* @param CanListOrders $canListOrders
|
|
* @param ListsOrders $listsOrders
|
|
*/
|
|
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
|
|
{
|
|
$this->canListOrders = $canListOrders;
|
|
$this->listsOrders = $listsOrders;
|
|
}
|
|
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$this->canListOrders->passes();
|
|
|
|
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
|
|
|
|
return $this->collectionResponse(OrderV2Resource::collection($query));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|