mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-31 10:24:25 +00:00
WIP - Order steps & remaining APIs
This commit is contained in:
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\DeletesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanDeleteContainerPackingList;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteContainerPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Deleted ContainerPackingList',
|
||||
'message' => 'You have successfully deleted a ContainerPackingList'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CanDeleteContainerPackingList */
|
||||
private $canDeleteContainerPackingList;
|
||||
|
||||
/** @var DeletesContainerPackingList */
|
||||
private $deletesContainerPackingList;
|
||||
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/**
|
||||
* DeleteContainerPackingListControllersLogic constructor.
|
||||
* @param CanDeleteContainerPackingList $canDeleteContainerPackingList
|
||||
* @param DeletesContainerPackingList $deletesContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
*/
|
||||
public function __construct(CanDeleteContainerPackingList $canDeleteContainerPackingList, DeletesContainerPackingList $deletesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList)
|
||||
{
|
||||
$this->canDeleteContainerPackingList = $canDeleteContainerPackingList;
|
||||
$this->deletesContainerPackingList = $deletesContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canDeleteContainerPackingList->passes();
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->deletesContainerPackingList->execute($query);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user