mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 12:34:01 +00:00
61 lines
1.7 KiB
PHP
61 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
|
|
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
|
|
use App\Http\Resources\PackingListNullOrderResource;
|
|
use App\Http\Resources\PackingListResource;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ListPackingListsLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Retrieved PackingLists',
|
|
'message' => 'You have successfully retrieved a list of PackingLists'
|
|
];
|
|
}
|
|
|
|
/** @var CanListPackingLists */
|
|
private $canListPackingLists;
|
|
|
|
/** @var ListsPackingLists */
|
|
private $listsPackingLists;
|
|
|
|
/**
|
|
* ListPackingListsLogic constructor.
|
|
* @param CanListPackingLists $canListPackingLists
|
|
* @param ListsPackingLists $listsPackingLists
|
|
*/
|
|
public function __construct(CanListPackingLists $canListPackingLists, ListsPackingLists $listsPackingLists)
|
|
{
|
|
$this->canListPackingLists = $canListPackingLists;
|
|
$this->listsPackingLists = $listsPackingLists;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws ErrorException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$this->canListPackingLists->passes();
|
|
|
|
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters')));
|
|
|
|
return $this->collectionResponse(PackingListResource::collection($query));
|
|
}
|
|
|
|
}
|