From 7ae581300de37ecc51377cf98d947940e2cde21c Mon Sep 17 00:00:00 2001 From: Fairuz Date: Sat, 24 Jul 2021 11:39:40 +0800 Subject: [PATCH] WIP - Order steps & remaining APIs --- .../CreateContainerPackingListLogic.php | 67 +++++ .../DeleteContainerPackingListLogic.php | 73 +++++ .../FetchContainerPackingListLogic 2.php | 66 ++++ .../FetchContainerPackingListLogic.php | 66 ++++ .../ListContainerPackingListsLogic.php | 66 ++++ .../UpdateContainerPackingListLogic.php | 86 ++++++ .../ContainerPackingListObject.php | 4 +- .../Services/CreatesContainerPackingList.php | 27 ++ .../Services/DeletesContainerPackingList.php | 19 ++ .../Services/FetchesContainerPackingList.php | 33 ++ .../Services/ListsContainerPackingLists.php | 33 ++ .../Services/UpdatesContainerPackingList.php | 27 ++ .../Rules/CanCreateContainerPackingList.php | 57 ++++ .../Rules/CanDeleteContainerPackingList.php | 43 +++ .../Rules/CanFetchContainerPackingList.php | 43 +++ .../Rules/CanListContainerPackingLists.php | 43 +++ .../Rules/CanUpdateContainerPackingList.php | 57 ++++ .../ContainerPackingListPackageValidation.php | 41 +++ .../ContainerPackingListValidation 2.php | 41 +++ .../ContainerPackingListValidation.php | 45 +++ .../CreateContainerPackingListLogic.php | 74 ----- .../FetchContainerPackingListLogic.php | 66 ---- .../Services/CreatesContainerPackingList.php | 32 -- .../ControllersLogic/CreateTransportLogic.php | 2 +- .../DataTransferObjects/TransportObject.php | 10 +- .../Transports/Services/CreatesTransport.php | 21 +- .../Transports/Services/UpdatesTransport.php | 15 +- .../Validators/TransportValidation.php | 12 +- .../CreateContainerPackingListController.php | 20 ++ .../DeleteContainerPackingListController.php | 20 ++ .../FetchContainerPackingListController.php | 20 ++ .../ListContainerPackingListsController.php | 20 ++ .../UpdateContainerPackingListController.php | 20 ++ .../Transports/CreateTransportController.php | 2 +- .../Transports/DeleteTransportController.php | 2 +- .../Transports/FetchTransportController.php | 2 +- .../Transports/ListTransportsController.php | 2 +- .../Transports/UpdateTransportController.php | 2 +- app/Models/ContainerPackingList.php | 2 + ...TransportArrangement.php => Transport.php} | 12 +- ...34_create_transport_arrangements_table.php | 2 +- resources/views/swagger/json.blade.php | 284 ++++++++++++++++++ routes/package.php | 4 +- routes/packinglist.php | 10 +- routes/schedule.php | 2 +- routes/transport.php | 2 +- 46 files changed, 1379 insertions(+), 218 deletions(-) create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/CreateContainerPackingListLogic.php create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/DeleteContainerPackingListLogic.php create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic 2.php create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic.php create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/ListContainerPackingListsLogic.php create mode 100644 app/Classes/Modules/ContainerPackingLists/ControllersLogic/UpdateContainerPackingListLogic.php rename app/Classes/Modules/{PackingLists => ContainerPackingLists}/DataTransferObjects/ContainerPackingListObject.php (87%) create mode 100644 app/Classes/Modules/ContainerPackingLists/Services/CreatesContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Services/DeletesContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Services/FetchesContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Services/ListsContainerPackingLists.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Services/UpdatesContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanCreateContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanDeleteContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanFetchContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanListContainerPackingLists.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanUpdateContainerPackingList.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListPackageValidation.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation 2.php create mode 100644 app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation.php delete mode 100644 app/Classes/Modules/PackingLists/ControllersLogic/CreateContainerPackingListLogic.php delete mode 100644 app/Classes/Modules/PackingLists/ControllersLogic/FetchContainerPackingListLogic.php delete mode 100644 app/Classes/Modules/PackingLists/Services/CreatesContainerPackingList.php create mode 100644 app/Http/Controllers/PackingLists/Containers/CreateContainerPackingListController.php create mode 100644 app/Http/Controllers/PackingLists/Containers/DeleteContainerPackingListController.php create mode 100644 app/Http/Controllers/PackingLists/Containers/FetchContainerPackingListController.php create mode 100644 app/Http/Controllers/PackingLists/Containers/ListContainerPackingListsController.php create mode 100644 app/Http/Controllers/PackingLists/Containers/UpdateContainerPackingListController.php rename app/Models/{TransportArrangement.php => Transport.php} (52%) diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/CreateContainerPackingListLogic.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/CreateContainerPackingListLogic.php new file mode 100644 index 00000000..842338a1 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/CreateContainerPackingListLogic.php @@ -0,0 +1,67 @@ + 'Created PackingList', + 'message' => 'You have successfully created a new PackingList' + ]; + } + + /** @var CanCreateContainerPackingList */ + private $canCreateContainerPackingList; + + /** @var FetchesPackingList */ + private $fetchesPackingList; + + /** @var CreatesPackingList */ + private $createsContainerPackingList; + + public function __construct(CanCreateContainerPackingList $canCreateContainerPackingList, FetchesPackingList $fetchesPackingList, CreatesContainerPackingList $createsContainerPackingList) + { + $this->canCreateContainerPackingList = $canCreateContainerPackingList; + $this->fetchesPackingList = $fetchesPackingList; + $this->createsContainerPackingList = $createsContainerPackingList; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + + $packingList = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]); + + $object = new ContainerPackingListObject( $packingList->id , $request->input('container_reference'), $request->input('container_type'), $request->input('seal_reference')); + + $this->canCreateContainerPackingList->passes($object); + + $query = $this->createsContainerPackingList->execute($object); + + return $this->resourceResponse(new PackingListResource($packingList)); + + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/DeleteContainerPackingListLogic.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/DeleteContainerPackingListLogic.php new file mode 100644 index 00000000..dfd94848 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/DeleteContainerPackingListLogic.php @@ -0,0 +1,73 @@ + '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()); + } + + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic 2.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic 2.php new file mode 100644 index 00000000..74d4b418 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic 2.php @@ -0,0 +1,66 @@ + 'Retrieved ContainerPackingList', + 'message' => 'You have successfully retrieved a ContainerPackingList' + ]; + } + + /** @var CanFetchContainerPackingList */ + private $canFetchContainerPackingList; + + /** @var FetchesContainerPackingList */ + private $fetchesContainerPackingList; + + /** + * FetchContainerPackingListControllersLogic constructor. + * @param CanFetchContainerPackingList $canFetchContainerPackingList + * @param FetchesContainerPackingList $fetchesContainerPackingList + */ + public function __construct(CanFetchContainerPackingList $canFetchContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList) + { + $this->canFetchContainerPackingList = $canFetchContainerPackingList; + $this->fetchesContainerPackingList = $fetchesContainerPackingList; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canFetchContainerPackingList->passes(); + + $query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new ContainerPackingListResource($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic.php new file mode 100644 index 00000000..21e4e1c9 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/FetchContainerPackingListLogic.php @@ -0,0 +1,66 @@ + 'Retrieved ContainerPackingList', + 'message' => 'You have successfully retrieved a ContainerPackingList' + ]; + } + + /** @var CanFetchContainerPackingList */ + private $canFetchContainerPackingList; + + /** @var FetchesContainerPackingList */ + private $fetchesContainerPackingList; + + /** + * FetchContainerPackingListControllersLogic constructor. + * @param CanFetchContainerPackingList $canFetchContainerPackingList + * @param FetchesContainerPackingList $fetchesContainerPackingList + */ + public function __construct(CanFetchContainerPackingList $canFetchContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList) + { + $this->canFetchContainerPackingList = $canFetchContainerPackingList; + $this->fetchesContainerPackingList = $fetchesContainerPackingList; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canFetchContainerPackingList->passes(); + + $query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new ContainerPackingListResource($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/ListContainerPackingListsLogic.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/ListContainerPackingListsLogic.php new file mode 100644 index 00000000..50e34101 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/ListContainerPackingListsLogic.php @@ -0,0 +1,66 @@ + 'Retrieved ContainerPackingLists', + 'message' => 'You have successfully retrieved a list of ContainerPackingLists' + ]; + } + + /** @var CanListContainerPackingLists */ + private $canListContainerPackingLists; + + /** @var ListsContainerPackingLists */ + private $listsContainerPackingLists; + + /** + * ListContainerPackingListsLogic constructor. + * @param CanListContainerPackingLists $canListContainerPackingLists + * @param ListsContainerPackingLists $listsContainerPackingLists + */ + public function __construct(CanListContainerPackingLists $canListContainerPackingLists, ListsContainerPackingLists $listsContainerPackingLists) + { + $this->canListContainerPackingLists = $canListContainerPackingLists; + $this->listsContainerPackingLists = $listsContainerPackingLists; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canListContainerPackingLists->passes(); + + $query = $this->listsContainerPackingLists->execute($this->listsContainerPackingLists->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(ContainerPackingListResource::collection($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/ControllersLogic/UpdateContainerPackingListLogic.php b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/UpdateContainerPackingListLogic.php new file mode 100644 index 00000000..a614c230 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/ControllersLogic/UpdateContainerPackingListLogic.php @@ -0,0 +1,86 @@ + 'Updated ContainerPackingList', + 'message' => 'You have successfully updated the ContainerPackingList' + ]; + } + + /** @var CanUpdateContainerPackingList */ + private $canUpdateContainerPackingList; + + /** @var UpdatesContainerPackingList */ + private $updatesContainerPackingList; + + /** @var FetchesContainerPackingList */ + private $fetchesContainerPackingList; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** + * UpdateContainerPackingListLogic constructor. + * @param CanUpdateContainerPackingList $canUpdateContainerPackingList + * @param UpdatesContainerPackingList $updatesContainerPackingList + * @param FetchesContainerPackingList $fetchesContainerPackingList + * @param FetchesDistrict $fetchesDistrict + */ + public function __construct(CanUpdateContainerPackingList $canUpdateContainerPackingList, UpdatesContainerPackingList $updatesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList, FetchesDistrict $fetchesDistrict) + { + $this->canUpdateContainerPackingList = $canUpdateContainerPackingList; + $this->updatesContainerPackingList = $updatesContainerPackingList; + $this->fetchesContainerPackingList = $fetchesContainerPackingList; + $this->fetchesDistrict = $fetchesDistrict; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]); + $object = new ContainerPackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + //$object = new ContainerPackingListObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing')); + + $this->canUpdateContainerPackingList->passes($object); + + $query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]); + + $query = $this->updatesContainerPackingList->execute($query, $object); + + return $this->resourceResponse(new ContainerPackingListResource($query)); + + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/PackingLists/DataTransferObjects/ContainerPackingListObject.php b/app/Classes/Modules/ContainerPackingLists/DataTransferObjects/ContainerPackingListObject.php similarity index 87% rename from app/Classes/Modules/PackingLists/DataTransferObjects/ContainerPackingListObject.php rename to app/Classes/Modules/ContainerPackingLists/DataTransferObjects/ContainerPackingListObject.php index aff6356a..97ceae5c 100644 --- a/app/Classes/Modules/PackingLists/DataTransferObjects/ContainerPackingListObject.php +++ b/app/Classes/Modules/ContainerPackingLists/DataTransferObjects/ContainerPackingListObject.php @@ -1,10 +1,10 @@ packing_list_id = $object->getPackingListId(); + $model->container_reference = $object->getContainerReference(); + $model->container_type = $object->getContainerType(); + $model->seal_reference = $object->getSealReference(); + + return $this->handler($model); + } +} diff --git a/app/Classes/Modules/ContainerPackingLists/Services/DeletesContainerPackingList.php b/app/Classes/Modules/ContainerPackingLists/Services/DeletesContainerPackingList.php new file mode 100644 index 00000000..abd524eb --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Services/DeletesContainerPackingList.php @@ -0,0 +1,19 @@ +handler($model); + } +} diff --git a/app/Classes/Modules/ContainerPackingLists/Services/FetchesContainerPackingList.php b/app/Classes/Modules/ContainerPackingLists/Services/FetchesContainerPackingList.php new file mode 100644 index 00000000..a10e13de --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Services/FetchesContainerPackingList.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/ContainerPackingLists/Services/ListsContainerPackingLists.php b/app/Classes/Modules/ContainerPackingLists/Services/ListsContainerPackingLists.php new file mode 100644 index 00000000..e3991a3f --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Services/ListsContainerPackingLists.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/ContainerPackingLists/Services/UpdatesContainerPackingList.php b/app/Classes/Modules/ContainerPackingLists/Services/UpdatesContainerPackingList.php new file mode 100644 index 00000000..649e3077 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Services/UpdatesContainerPackingList.php @@ -0,0 +1,27 @@ +container_reference = $object->getContainerReference(); + $model->container_type = $object->getContainerType(); + $model->seal_reference = $object->getSealReference(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanCreateContainerPackingList.php b/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanCreateContainerPackingList.php new file mode 100644 index 00000000..d12e0aa3 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanCreateContainerPackingList.php @@ -0,0 +1,57 @@ +containerPackingListValidation = $containerPackingListValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param PackingListObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->containerPackingListValidation->validate($object); + + } + + + /** + * @param PackingListObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanDeleteContainerPackingList.php b/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanDeleteContainerPackingList.php new file mode 100644 index 00000000..7056d7a4 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Standards/Rules/CanDeleteContainerPackingList.php @@ -0,0 +1,43 @@ +ContainerPackingListValidation = $ContainerPackingListValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param ContainerPackingListObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->ContainerPackingListValidation->validate($object); + + } + + + /** + * @param ContainerPackingListObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListPackageValidation.php b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListPackageValidation.php new file mode 100644 index 00000000..ad87e77e --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListPackageValidation.php @@ -0,0 +1,41 @@ + $object->getPackingListId(), + 'package_id' => $object->getPackageId() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'packing_list_id' => 'required', + 'package_id' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation 2.php b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation 2.php new file mode 100644 index 00000000..65dd3380 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation 2.php @@ -0,0 +1,41 @@ + $object->getStatus(), + 'reference' => $object->getReference() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'status' => 'required', + 'reference' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation.php b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation.php new file mode 100644 index 00000000..0ff94dc7 --- /dev/null +++ b/app/Classes/Modules/ContainerPackingLists/Standards/Validators/ContainerPackingListValidation.php @@ -0,0 +1,45 @@ + $object->getPackingListId(), + 'reference' => $object->getContainerReference(), + 'container_type' => $object->getContainerType(), + 'seal_reference' => $object->getSealReference(), + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'status' => 'required', + 'reference' => 'required', + 'container_type' => 'required', + 'seal_reference' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/CreateContainerPackingListLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/CreateContainerPackingListLogic.php deleted file mode 100644 index be09d7a8..00000000 --- a/app/Classes/Modules/PackingLists/ControllersLogic/CreateContainerPackingListLogic.php +++ /dev/null @@ -1,74 +0,0 @@ - 'Created PackingList', - 'message' => 'You have successfully created a new PackingList' - ]; - } - - /** @var CanCreatePackingList */ - private $canCreatePackingList; - - /** @var FetchesCompany */ - private $fetchesCompany; - - /** @var CreatesPackingList */ - private $createsPackingList; - - /** - * CreatePackingListLogic constructor. - * @param CanCreatePackingList $canCreatePackingList - * @param FetchesDistrict $fetchesDistrict - * @param FetchesCompany $fetchesCompany - * @param CreatesPackingList $createsPackingList - */ - public function __construct(CanCreatePackingList $canCreatePackingList, FetchesCompany $fetchesCompany, CreatesPackingList $createsPackingList) - { - $this->canCreatePackingList = $canCreatePackingList; - $this->fetchesCompany = $fetchesCompany; - $this->createsPackingList = $createsPackingList; - } - - /** - * @param Request $request - * @return JsonResponse - * @throws \App\Classes\Exceptions\AccessForbiddenException - * @throws \App\Classes\Exceptions\MalformedRequestException - * @throws \App\Classes\Exceptions\RequestValidationException - */ - public function logic(Request $request) : JsonResponse - { - - $district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]); - - $object = new PackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); - - $this->canCreatePackingList->passes($object); - - $query = $this->createsPackingList->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object); - - return $this->resourceResponse(new PackingListResource($query)); - - } - -} diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/FetchContainerPackingListLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/FetchContainerPackingListLogic.php deleted file mode 100644 index e9248ada..00000000 --- a/app/Classes/Modules/PackingLists/ControllersLogic/FetchContainerPackingListLogic.php +++ /dev/null @@ -1,66 +0,0 @@ - 'Retrieved PackingList', - 'message' => 'You have successfully retrieved a PackingList' - ]; - } - - /** @var CanFetchPackingList */ - private $canFetchPackingList; - - /** @var FetchesPackingList */ - private $fetchesPackingList; - - /** - * FetchPackingListControllersLogic constructor. - * @param CanFetchPackingList $canFetchPackingList - * @param FetchesPackingList $fetchesPackingList - */ - public function __construct(CanFetchPackingList $canFetchPackingList, FetchesPackingList $fetchesPackingList) - { - $this->canFetchPackingList = $canFetchPackingList; - $this->fetchesPackingList = $fetchesPackingList; - } - - - /** - * @param Request $request - * @return JsonResponse - * @throws ErrorException - */ - public function logic(Request $request) : JsonResponse - { - try { - - $this->canFetchPackingList->passes(); - - $query = $this->fetchesPackingList->execute(['id' => $request->route('id')]); - - return $this->resourceResponse(new PackingListResource($query)); - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } - - } - -} diff --git a/app/Classes/Modules/PackingLists/Services/CreatesContainerPackingList.php b/app/Classes/Modules/PackingLists/Services/CreatesContainerPackingList.php deleted file mode 100644 index 05f7c000..00000000 --- a/app/Classes/Modules/PackingLists/Services/CreatesContainerPackingList.php +++ /dev/null @@ -1,32 +0,0 @@ -street_one = $object->getStreetOne(); - $model->street_two = $object->getStreetTwo(); - $model->country_id = $object->getCountryId(); - $model->state_id = $object->getStateId(); - $model->district_id = $object->getDistrictId(); - $model->postcode = $object->getPostCode(); - - return $this->handler($company->PackingLists(), $model); - - } -} diff --git a/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php b/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php index 1b30b95d..1d6b6d21 100644 --- a/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php +++ b/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php @@ -8,7 +8,7 @@ use App\Classes\Modules\Transports\Services\CreatesTransport; use App\Classes\Modules\Transports\Services\FetchesDistrict; use App\Classes\Modules\Transports\Standards\Rules\CanCreateTransport; use App\Classes\Modules\Transports\DataTransferObjects\TransportObject; -use App\Classes\Modules\PackingLists\Services\FetchesContainerPackingList; +use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList; use App\Http\Resources\TransportResource; use ErrorException; use Illuminate\Http\JsonResponse; diff --git a/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php b/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php index 4f82c78b..bc493ca4 100644 --- a/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php +++ b/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php @@ -50,7 +50,7 @@ class TransportObject implements DataTransferObject */ public function getType(): string { - return $this->streetOne; + return $this->type; } /** @@ -58,7 +58,7 @@ class TransportObject implements DataTransferObject */ public function getCourier(): ?string { - return $this->streetTwo; + return $this->courier; } /** @@ -66,13 +66,13 @@ class TransportObject implements DataTransferObject */ public function getTrackingNumber(): int { - return $this->countryId; + return $this->tracking_number; } /** * @return int */ - public function getDispatchDate(): Carbon + public function getDispatchDate(): ?Carbon { return $this->dispatch_date ? Carbon::parse($this->dispatch_date) : null; } @@ -80,7 +80,7 @@ class TransportObject implements DataTransferObject /** * @return int */ - public function getDropDate(): Carbon + public function getDropDate(): ?Carbon { return $this->drop_date ? Carbon::parse($this->drop_date) : null; } diff --git a/app/Classes/Modules/Transports/Services/CreatesTransport.php b/app/Classes/Modules/Transports/Services/CreatesTransport.php index 80a08a16..53981bd8 100644 --- a/app/Classes/Modules/Transports/Services/CreatesTransport.php +++ b/app/Classes/Modules/Transports/Services/CreatesTransport.php @@ -6,27 +6,28 @@ use App\Classes\General\Eloquent\AbstractUpdateRecord; use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\Modules\Transports\DataTransferObjects\TransportObject; use App\Models\Transport; -use App\Models\Company; +use App\Models\ContainerPackingList; class CreatesTransport extends AbstractUpdateRelationshipRecord { /** - * @param Company $company + * @param ContainerPackingList $containerPackingList * @param TransportObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(Company $company, TransportObject $object) { + public function execute(ContainerPackingList $containerPackingList, TransportObject $object) { $model = new Transport(); - $model->street_one = $object->getStreetOne(); - $model->street_two = $object->getStreetTwo(); - $model->country_id = $object->getCountryId(); - $model->state_id = $object->getStateId(); - $model->district_id = $object->getDistrictId(); - $model->postcode = $object->getPostCode(); - return $this->handler($company->Transports(), $model); + $model->type = $object->getType(); + $model->courier = $object->getCourier(); + $model->tracking_number = $object->getTrackingNumber(); + $model->dispatch_date = $object->getDispatchDate(); + $model->drop_date = $object->getDropDate(); + $model->status = $object->getStatus(); + + return $this->handler($containerPackingList->transports(), $model); } } diff --git a/app/Classes/Modules/Transports/Services/UpdatesTransport.php b/app/Classes/Modules/Transports/Services/UpdatesTransport.php index 155e793d..4172a3db 100644 --- a/app/Classes/Modules/Transports/Services/UpdatesTransport.php +++ b/app/Classes/Modules/Transports/Services/UpdatesTransport.php @@ -17,15 +17,12 @@ class UpdatesTransport extends AbstractUpdateRecord */ public function execute(Transport $model, TransportObject $object) { - //$model->company_id = $object->getCompanyId(); - $model->street_one = $object->getStreetOne(); - $model->street_two = $object->getStreetTwo(); - $model->district_id = $object->getDistrictId(); - $model->state_id = $object->getStateId(); - $model->postcode = $object->getPostCode(); - $model->country_id = $object->getCountryId(); - //$model->default = $object->getDefault(); - //$model->billing = $object->getBilling(); + $model->type = $object->getType(); + $model->courier = $object->getCourier(); + $model->tracking_number = $object->getTrackingNumber(); + $model->dispatch_date = $object->getDispatchDate(); + $model->drop_date = $object->getDropDate(); + $model->status = $object->getStatus(); return $this->handler($model); diff --git a/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php b/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php index 0a41982b..daefb5dd 100644 --- a/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php +++ b/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php @@ -18,10 +18,10 @@ class TransportValidation extends AbstractValidation return [ 'type' => $object->getType(), 'courier' => $object->getCourier(), - 'tracking_number' => $object->getTrackingNumber() - 'dispacth_date' => $object->getDispatchDate() - 'drop_date' => $object->getDropDate() - 'status' => $object->getStatus() + 'tracking_number' => $object->getTrackingNumber(), + 'dispacth_date' => $object->getDispatchDate(), + 'drop_date' => $object->getDropDate(), + 'status' => $object->getStatus(), ]; } @@ -33,9 +33,7 @@ class TransportValidation extends AbstractValidation 'type' => 'required', 'courier' => 'required', 'tracking_number' => 'required', - 'dispacth_date' => '', - 'drop_date' => '', - 'status' => '', + 'status' => 'required', ]; } diff --git a/app/Http/Controllers/PackingLists/Containers/CreateContainerPackingListController.php b/app/Http/Controllers/PackingLists/Containers/CreateContainerPackingListController.php new file mode 100644 index 00000000..257128c9 --- /dev/null +++ b/app/Http/Controllers/PackingLists/Containers/CreateContainerPackingListController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/PackingLists/Containers/DeleteContainerPackingListController.php b/app/Http/Controllers/PackingLists/Containers/DeleteContainerPackingListController.php new file mode 100644 index 00000000..25cb6bb8 --- /dev/null +++ b/app/Http/Controllers/PackingLists/Containers/DeleteContainerPackingListController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/PackingLists/Containers/FetchContainerPackingListController.php b/app/Http/Controllers/PackingLists/Containers/FetchContainerPackingListController.php new file mode 100644 index 00000000..0fecdb0a --- /dev/null +++ b/app/Http/Controllers/PackingLists/Containers/FetchContainerPackingListController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/PackingLists/Containers/ListContainerPackingListsController.php b/app/Http/Controllers/PackingLists/Containers/ListContainerPackingListsController.php new file mode 100644 index 00000000..12c01a28 --- /dev/null +++ b/app/Http/Controllers/PackingLists/Containers/ListContainerPackingListsController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/PackingLists/Containers/UpdateContainerPackingListController.php b/app/Http/Controllers/PackingLists/Containers/UpdateContainerPackingListController.php new file mode 100644 index 00000000..eac24070 --- /dev/null +++ b/app/Http/Controllers/PackingLists/Containers/UpdateContainerPackingListController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/Transports/CreateTransportController.php b/app/Http/Controllers/Transports/CreateTransportController.php index e9b179ed..e1852f4a 100644 --- a/app/Http/Controllers/Transports/CreateTransportController.php +++ b/app/Http/Controllers/Transports/CreateTransportController.php @@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\CreateTransportLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class CreateRemarkController +class CreateTransportController { /** * @param Request $request diff --git a/app/Http/Controllers/Transports/DeleteTransportController.php b/app/Http/Controllers/Transports/DeleteTransportController.php index c30f17ea..e1ff8e66 100644 --- a/app/Http/Controllers/Transports/DeleteTransportController.php +++ b/app/Http/Controllers/Transports/DeleteTransportController.php @@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\DeleteTransportLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class DeleteRemarkController +class DeleteTransportController { /** * @param Request $request diff --git a/app/Http/Controllers/Transports/FetchTransportController.php b/app/Http/Controllers/Transports/FetchTransportController.php index 7ab2b449..33df3c38 100644 --- a/app/Http/Controllers/Transports/FetchTransportController.php +++ b/app/Http/Controllers/Transports/FetchTransportController.php @@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\FetchTransportLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class FetchRemarkController +class FetchTransportController { /** * @param Request $request diff --git a/app/Http/Controllers/Transports/ListTransportsController.php b/app/Http/Controllers/Transports/ListTransportsController.php index 8050ca13..cc704684 100644 --- a/app/Http/Controllers/Transports/ListTransportsController.php +++ b/app/Http/Controllers/Transports/ListTransportsController.php @@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\ListTransportsLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class ListRemarksController +class ListTransportsController { /** * @param Request $request diff --git a/app/Http/Controllers/Transports/UpdateTransportController.php b/app/Http/Controllers/Transports/UpdateTransportController.php index 28704686..a475d96b 100644 --- a/app/Http/Controllers/Transports/UpdateTransportController.php +++ b/app/Http/Controllers/Transports/UpdateTransportController.php @@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\UpdateTransportLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class UpdateRemarkController +class UpdateTransportController { /** * @param Request $request diff --git a/app/Models/ContainerPackingList.php b/app/Models/ContainerPackingList.php index 228c6fce..4aa74c4b 100644 --- a/app/Models/ContainerPackingList.php +++ b/app/Models/ContainerPackingList.php @@ -3,6 +3,8 @@ namespace App\Models; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphMany; class ContainerPackingList extends AbstractModel { diff --git a/app/Models/TransportArrangement.php b/app/Models/Transport.php similarity index 52% rename from app/Models/TransportArrangement.php rename to app/Models/Transport.php index 3bb122d1..53491743 100644 --- a/app/Models/TransportArrangement.php +++ b/app/Models/Transport.php @@ -4,12 +4,22 @@ namespace App\Models; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphMany; class Transport extends AbstractModel { use SoftDeletes; - protected $table = 'schedules'; + protected $table = 'transport_arrangements'; + + /** + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function owner(): morphTo + { + return $this->morphTo(); + } /** * @return MorphMany diff --git a/database/migrations/2021_07_21_110434_create_transport_arrangements_table.php b/database/migrations/2021_07_21_110434_create_transport_arrangements_table.php index cc642694..c01bbe62 100644 --- a/database/migrations/2021_07_21_110434_create_transport_arrangements_table.php +++ b/database/migrations/2021_07_21_110434_create_transport_arrangements_table.php @@ -21,7 +21,7 @@ class CreateTransportArrangementsTable extends Migration $table->string('courier',45); $table->string('tracking_number',45); - $table->timestamp('dispacth_date')->nullable(); + $table->timestamp('dispatch_date')->nullable(); $table->timestamp('drop_date')->nullable(); $table->integer('status')->default(0); diff --git a/resources/views/swagger/json.blade.php b/resources/views/swagger/json.blade.php index 397844e4..bb246504 100644 --- a/resources/views/swagger/json.blade.php +++ b/resources/views/swagger/json.blade.php @@ -300,6 +300,283 @@ } } }, + "/packing_list/container/create": { + "post": { + "tags": [ + "Packing" + ], + "produces": [ + "application/json" + ], + "operationId": "createContainerPackingList", + "summary": "Create container packing list", + "description": "", + "parameters": [ + { + "name": "packing_list_id", + "in": "query", + "description": "Packing list id", + "required": true, + "type": "integer" + }, + { + "name": "container_reference", + "in": "query", + "description": "Container reference", + "required": true, + "type": "string" + }, + { + "name": "container_type", + "in": "query", + "description": "Container type", + "required": true, + "type": "string" + }, + { + "name": "seal_reference", + "in": "query", + "description": "Seal reference", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Expires-After": { + "type": "string", + "format": "date-time", + "description": "date in UTC when token expires" + }, + "X-Rate-Limit": { + "type": "integer", + "format": "int32", + "description": "calls per hour allowed by the user" + } + }, + "schema": { + "type": "string" + } + }, + "422": { + "description": "Invalid input supplied" + } + } + } + }, + "/packing_list/container/list": { + "get": { + "tags": [ + "Packing" + ], + "produces": [ + "application/json" + ], + "operationId": "containerListPacking", + "summary": "Container list packing", + "description": "", + "parameters": [ + { + "name": "filter", + "in": "query", + "description": "Filters", + "required": false, + "type": "array", + "items": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Expires-After": { + "type": "string", + "format": "date-time", + "description": "date in UTC when token expires" + }, + "X-Rate-Limit": { + "type": "integer", + "format": "int32", + "description": "calls per hour allowed by the user" + } + }, + "schema": { + "type": "string" + } + }, + "422": { + "description": "Invalid input supplied" + } + } + } + }, + "/packing_list/container/{id}/show": { + "get": { + "tags": [ + "Packing" + ], + "produces": [ + "application/json" + ], + "operationId": "showPacking", + "summary": "Show container packing list", + "description": "", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Container packing list id", + "required": true, + "type": "integer" + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Expires-After": { + "type": "string", + "format": "date-time", + "description": "date in UTC when token expires" + }, + "X-Rate-Limit": { + "type": "integer", + "format": "int32", + "description": "calls per hour allowed by the user" + } + }, + "schema": { + "type": "string" + } + }, + "422": { + "description": "Invalid input supplied" + } + } + } + }, + "/packing_list/container/update/{id}": { + "put": { + "tags": [ + "Packing" + ], + "produces": [ + "application/json" + ], + "operationId": "updatePacking", + "summary": "Update packing", + "description": "", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Container packing list id", + "required": true, + "type": "integer" + }, + { + "name": "packing_list_id", + "in": "query", + "description": "Packing list id", + "required": true, + "type": "integer" + }, + { + "name": "container_reference", + "in": "query", + "description": "Container reference", + "required": true, + "type": "string" + }, + { + "name": "container_type", + "in": "query", + "description": "Container type", + "required": true, + "type": "string" + }, + { + "name": "seal_reference", + "in": "query", + "description": "Seal reference", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Expires-After": { + "type": "string", + "format": "date-time", + "description": "date in UTC when token expires" + }, + "X-Rate-Limit": { + "type": "integer", + "format": "int32", + "description": "calls per hour allowed by the user" + } + }, + "schema": { + "type": "string" + } + }, + "422": { + "description": "Invalid input supplied" + } + } + } + }, + "/packing_list/container/delete/{id}": { + "delete": { + "tags": [ + "Packing" + ], + "produces": [ + "application/json" + ], + "operationId": "deleteContainerPackingList", + "summary": "Delete container packing list", + "description": "", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Container packing list id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "headers": { + "X-Expires-After": { + "type": "string", + "format": "date-time", + "description": "date in UTC when token expires" + }, + "X-Rate-Limit": { + "type": "integer", + "format": "int32", + "description": "calls per hour allowed by the user" + } + }, + "schema": { + "type": "string" + } + }, + "422": { + "description": "Invalid input supplied" + } + } + } + }, "/bank/create": { "post": { "tags": [ @@ -1178,6 +1455,13 @@ "summary": "Create transport", "description": "", "parameters": [ + { + "name": "container_id", + "in": "query", + "description": "Container Id", + "required": true, + "type": "integer" + }, { "name": "type", "in": "query", diff --git a/routes/package.php b/routes/package.php index ab715764..e6e15fbd 100644 --- a/routes/package.php +++ b/routes/package.php @@ -4,14 +4,14 @@ use Illuminate\Support\Facades\Route; Route::group(['namespace' => 'Packages', 'as' => 'package.', 'prefix' => 'package'], function () { Route::get('/{id}/show', 'FetchPackageController@fetch')->name('show'); - Route::get('/list', 'ListPackageController@list')->name('list'); + Route::get('/list', 'ListPackagesController@list')->name('list'); Route::post('/create', 'CreatePackageController@create')->name('create'); Route::put('/update/{id}', 'UpdatePackageController@update')->name('update'); Route::delete('/delete/{id}', 'DeletePackageController@delete')->name('delete'); Route::group(['namespace' => 'PackageItems', 'prefix' => 'item', 'as' => 'item.'], function () { Route::get('/{id}/show', 'FetchPackageItemController@fetch')->name('show'); - Route::get('/list', 'ListPackageItemController@list')->name('list'); + Route::get('/list', 'ListPackageItemsController@list')->name('list'); Route::post('/create', 'CreatePackageItemController@create')->name('create'); Route::put('/update/{id}', 'UpdatePackageItemController@update')->name('update'); Route::delete('/delete/{id}', 'DeletePackageItemController@delete')->name('delete'); diff --git a/routes/packinglist.php b/routes/packinglist.php index 85062013..838b789b 100644 --- a/routes/packinglist.php +++ b/routes/packinglist.php @@ -4,8 +4,16 @@ use Illuminate\Support\Facades\Route; Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' => 'packing_list'], function () { Route::get('/{id}/show', 'FetchPackingListController@fetch')->name('show'); - Route::get('/list', 'ListPackingListController@list')->name('list'); + Route::get('/list', 'ListPackingListsController@list')->name('list'); Route::post('/create', 'CreatePackingListController@create')->name('create'); Route::put('/update/{id}', 'UpdatePackingListController@update')->name('update'); Route::delete('/delete/{id}', 'DeletePackingListController@delete')->name('delete'); + + Route::group(['namespace' => 'Containers', 'prefix' => 'container', 'as' => 'container.'], function () { + Route::get('/{id}/show', 'FetchContainerPackingListController@fetch')->name('show'); + Route::get('/list', 'ListContainerPackingListsController@list')->name('list'); + Route::post('/create', 'CreateContainerPackingListController@create')->name('create'); + Route::put('/update/{id}', 'UpdateContainerPackingListController@update')->name('update'); + Route::delete('/delete/{id}', 'DeleteContainerPackingListController@delete')->name('delete'); + }); }); diff --git a/routes/schedule.php b/routes/schedule.php index 5e0dc86f..3ac9fca5 100644 --- a/routes/schedule.php +++ b/routes/schedule.php @@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route; Route::group(['namespace' => 'Schedules', 'as' => 'schedule.', 'prefix' => 'schedule'], function () { Route::get('/{id}/show', 'FetchScheduleController@fetch')->name('show'); - Route::get('/list', 'ListScheduleController@list')->name('list'); + Route::get('/list', 'ListSchedulesController@list')->name('list'); Route::post('/create', 'CreateScheduleController@create')->name('create'); Route::put('/update/{id}', 'UpdateScheduleController@update')->name('update'); Route::delete('/delete/{id}', 'DeleteScheduleController@delete')->name('delete'); diff --git a/routes/transport.php b/routes/transport.php index 412005ee..507d7f90 100644 --- a/routes/transport.php +++ b/routes/transport.php @@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route; Route::group(['namespace' => 'Transports', 'as' => 'transport.', 'prefix' => 'transport'], function () { Route::get('/{id}/show', 'FetchTransportController@fetch')->name('show'); - Route::get('/list', 'ListTransportController@list')->name('list'); + Route::get('/list', 'ListTransportsController@list')->name('list'); Route::post('/create', 'CreateTransportController@create')->name('create'); Route::put('/update/{id}', 'UpdateTransportController@update')->name('update'); Route::delete('/delete/{id}', 'DeleteTransportController@delete')->name('delete');