mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
|
|
|
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
|
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
|
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
|
|
use App\Classes\Modules\PackingLists\Services\Packages\FetchesPackage;
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
|
|
use App\Classes\Modules\PackingLists\Services\CreatesPackingListPackage;
|
|
use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingList;
|
|
use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingListPackage;
|
|
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
|
use App\Http\Resources\PackingListResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CreatePackingListLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Created PackingList',
|
|
'message' => 'You have successfully created a new PackingList'
|
|
];
|
|
}
|
|
|
|
/** @var CreatePackingListProcessor */
|
|
private $createPackingListProcessor;
|
|
|
|
/**
|
|
* CreatePackingListLogic constructor.
|
|
* @param CreatePackingListProcessor $createPackingListProcessor
|
|
*/
|
|
public function __construct(CreatePackingListProcessor $createPackingListProcessor)
|
|
{
|
|
$this->createPackingListProcessor = $createPackingListProcessor;
|
|
}
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
|
|
$object = new PackingListObject($request->input('reference_number'), ApprovalStatus::PENDING_SUBMISSION);
|
|
|
|
$query = $this->createPackingListProcessor->execute($object);
|
|
|
|
return $this->resourceResponse(new PackingListResource($query));
|
|
|
|
}
|
|
|
|
}
|