diff --git a/.gitignore b/.gitignore index de84bee2..ac0eb695 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,8 @@ public/.DS_Store public/images/.DS_Store gox.iml rebuild_docker.sh +r.sh docker/* db/* docker-compose.yml -package-lock.json \ No newline at end of file +package-lock.json diff --git a/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php b/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php index c0b60806..b3bc375f 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/CreateCompanyLogic.php @@ -2,7 +2,7 @@ namespace App\Classes\Modules\Companies\ControllersLogic; - +use App\Classes\Modules\Unity\Processors\CreateEntityProcessor; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor; use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor; @@ -15,15 +15,19 @@ use Illuminate\Http\Request; class CreateCompanyLogic extends AbstractControllerLogic { + + private $createUnityEntityProcessor; + /** * CreateCompanyLogic constructor. * @param CreateCompanyProcessor $createCompanyProcessor * @param CreateCompanyModuleProcessor $createCompanyModuleProcessor */ - public function __construct(CreateCompanyProcessor $createCompanyProcessor ,CreateCompanyModuleProcessor $createCompanyModuleProcessor) + public function __construct(CreateCompanyProcessor $createCompanyProcessor ,CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateEntityProcessor $createUnityEntityProcessor) { $this->createCompanyProcessor = $createCompanyProcessor; $this->createCompanyModuleProcessor = $createCompanyModuleProcessor; + $this->createUnityEntityProcessor = $createUnityEntityProcessor; } /** @@ -53,7 +57,10 @@ class CreateCompanyLogic extends AbstractControllerLogic $this->createCompanyModuleProcessor->execute($company , $request->input('business_type')); + //$unityEntity = $this->createUnityEntityProcessor->execute($company->name); + //TODO: Update company table with hash id + return $this->resourceResponse(new CompanyResource($company)); } -} \ No newline at end of file +} diff --git a/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php b/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php index 97789148..343c0ad0 100644 --- a/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php +++ b/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php @@ -27,24 +27,23 @@ class GenerateOrderStepsProcessor private $createsManyOrderStep; - private $unityConfig; - private $updateOrderStepProcessors; - private $getContractObligationsProcessor; + private $getUnityContractObligationsProcessor; - public function __construct(UpdatesOrderCurrentStepProcessor $updatesOrderCurrentStep, CreatesManyOrderSteps $createsManyOrderStep, UpdateOrderStepsProcessor $updateOrderStepProcessors, GetContractObligationsProcessor $getContractObligationsProcessor) + public function __construct(UpdatesOrderCurrentStepProcessor $updatesOrderCurrentStep, CreatesManyOrderSteps $createsManyOrderStep, UpdateOrderStepsProcessor $updateOrderStepProcessors, GetContractObligationsProcessor $getUnityContractObligationsProcessor) { $this->updatesOrderCurrentStep = $updatesOrderCurrentStep; - $this->unityConfig = Config::get('unity'); $this->createsManyOrderStep = $createsManyOrderStep; $this->updateOrderStepProcessors = $updateOrderStepProcessors; - $this->getContractObligationsProcessor = $getContractObligationsProcessor; + $this->getUnityContractObligationsProcessor = $getUnityContractObligationsProcessor; } public function execute(Order $order){ - $obligations = $this->getContractObligationsProcessor->execute(); + $obligations = $this->getUnityContractObligationsProcessor->execute(); + + //TODO: Update Appointee ID to Entity User base on hash key foreach($obligations as $step){ $orderSteps[] = new OrderStepsObject( diff --git a/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php new file mode 100644 index 00000000..4eb7665e --- /dev/null +++ b/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php @@ -0,0 +1,79 @@ + 'Created Remark', + 'message' => 'You have successfully created a new Remark' + ]; + } + + /** @var CanCreateRemark */ + private $canCreateRemark; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** @var FetchesCompany */ + private $fetchesCompany; + + /** @var CreatesRemark */ + private $createsRemark; + + /** + * CreateRemarkLogic constructor. + * @param CanCreateRemark $canCreateRemark + * @param FetchesDistrict $fetchesDistrict + * @param FetchesCompany $fetchesCompany + * @param CreatesRemark $createsRemark + */ + public function __construct(CanCreateRemark $canCreateRemark, FetchesDistrict $fetchesDistrict, FetchesCompany $fetchesCompany, CreatesRemark $createsRemark) + { + $this->canCreateRemark = $canCreateRemark; + $this->fetchesDistrict = $fetchesDistrict; + $this->fetchesCompany = $fetchesCompany; + $this->createsRemark = $createsRemark; + } + + /** + * @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 RemarkObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + + $this->canCreateRemark->passes($object); + + $query = $this->createsRemark->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object); + + return $this->resourceResponse(new RemarkResource($query)); + + } + +} diff --git a/app/Classes/Modules/Remarks/ControllersLogic/DeleteRemarkLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/DeleteRemarkLogic.php new file mode 100644 index 00000000..f731cca5 --- /dev/null +++ b/app/Classes/Modules/Remarks/ControllersLogic/DeleteRemarkLogic.php @@ -0,0 +1,73 @@ + 'Deleted Remark', + 'message' => 'You have successfully deleted a Remark' + ]; + } + + + /** @var CanDeleteRemark */ + private $canDeleteRemark; + + /** @var DeletesRemark */ + private $deletesRemark; + + /** @var FetchesRemark */ + private $fetchesRemark; + + /** + * DeleteRemarkControllersLogic constructor. + * @param CanDeleteRemark $canDeleteRemark + * @param DeletesRemark $deletesRemark + * @param FetchesRemark $fetchesRemark + */ + public function __construct(CanDeleteRemark $canDeleteRemark, DeletesRemark $deletesRemark, FetchesRemark $fetchesRemark) + { + $this->canDeleteRemark = $canDeleteRemark; + $this->deletesRemark = $deletesRemark; + $this->fetchesRemark = $fetchesRemark; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canDeleteRemark->passes(); + + $query = $this->fetchesRemark->execute(['id' => $request->route('id')]); + + $this->deletesRemark->execute($query); + + return $this->response([]); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Remarks/ControllersLogic/FetchRemarkLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/FetchRemarkLogic.php new file mode 100644 index 00000000..3ff151d3 --- /dev/null +++ b/app/Classes/Modules/Remarks/ControllersLogic/FetchRemarkLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Remark', + 'message' => 'You have successfully retrieved a Remark' + ]; + } + + /** @var CanFetchRemark */ + private $canFetchRemark; + + /** @var FetchesRemark */ + private $fetchesRemark; + + /** + * FetchRemarkControllersLogic constructor. + * @param CanFetchRemark $canFetchRemark + * @param FetchesRemark $fetchesRemark + */ + public function __construct(CanFetchRemark $canFetchRemark, FetchesRemark $fetchesRemark) + { + $this->canFetchRemark = $canFetchRemark; + $this->fetchesRemark = $fetchesRemark; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canFetchRemark->passes(); + + $query = $this->fetchesRemark->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new RemarkResource($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Remarks/ControllersLogic/ListRemarksLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/ListRemarksLogic.php new file mode 100644 index 00000000..a7d7ff43 --- /dev/null +++ b/app/Classes/Modules/Remarks/ControllersLogic/ListRemarksLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Remarks', + 'message' => 'You have successfully retrieved a list of Remarks' + ]; + } + + /** @var CanListRemarks */ + private $canListRemarks; + + /** @var ListsRemarks */ + private $listsRemarks; + + /** + * ListRemarksLogic constructor. + * @param CanListRemarks $canListRemarks + * @param ListsRemarks $listsRemarks + */ + public function __construct(CanListRemarks $canListRemarks, ListsRemarks $listsRemarks) + { + $this->canListRemarks = $canListRemarks; + $this->listsRemarks = $listsRemarks; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canListRemarks->passes(); + + $query = $this->listsRemarks->execute($this->listsRemarks->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(RemarkResource::collection($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Remarks/ControllersLogic/UpdateRemarkLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/UpdateRemarkLogic.php new file mode 100644 index 00000000..020906eb --- /dev/null +++ b/app/Classes/Modules/Remarks/ControllersLogic/UpdateRemarkLogic.php @@ -0,0 +1,86 @@ + 'Updated Remark', + 'message' => 'You have successfully updated the Remark' + ]; + } + + /** @var CanUpdateRemark */ + private $canUpdateRemark; + + /** @var UpdatesRemark */ + private $updatesRemark; + + /** @var FetchesRemark */ + private $fetchesRemark; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** + * UpdateRemarkLogic constructor. + * @param CanUpdateRemark $canUpdateRemark + * @param UpdatesRemark $updatesRemark + * @param FetchesRemark $fetchesRemark + * @param FetchesDistrict $fetchesDistrict + */ + public function __construct(CanUpdateRemark $canUpdateRemark, UpdatesRemark $updatesRemark, FetchesRemark $fetchesRemark, FetchesDistrict $fetchesDistrict) + { + $this->canUpdateRemark = $canUpdateRemark; + $this->updatesRemark = $updatesRemark; + $this->fetchesRemark = $fetchesRemark; + $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 RemarkObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + //$object = new RemarkObject($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->canUpdateRemark->passes($object); + + $query = $this->fetchesRemark->execute(['id' => $request->route('id')]); + + $query = $this->updatesRemark->execute($query, $object); + + return $this->resourceResponse(new RemarkResource($query)); + + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Remarks/DataTransferObjects/RemarkObject.php b/app/Classes/Modules/Remarks/DataTransferObjects/RemarkObject.php new file mode 100644 index 00000000..67beaa30 --- /dev/null +++ b/app/Classes/Modules/Remarks/DataTransferObjects/RemarkObject.php @@ -0,0 +1,96 @@ +streetOne = $streetOne; + $this->streetTwo = $streetTwo; + $this->countryId = $countryId; + $this->stateId = $stateId; + $this->districtId = $districtId; + $this->postCode = $postCode; + } + + /** + * @return string + */ + public function getStreetOne(): string + { + return $this->streetOne; + } + + /** + * @return null|string + */ + public function getStreetTwo(): ?string + { + return $this->streetTwo; + } + + /** + * @return int + */ + public function getCountryId(): int + { + return $this->countryId; + } + + /** + * @return int + */ + public function getStateId(): int + { + return $this->stateId; + } + + /** + * @return int + */ + public function getDistrictId(): int + { + return $this->districtId; + } + + /** + * @return int + */ + public function getPostCode(): int + { + return $this->postCode; + } + + +} diff --git a/app/Classes/Modules/Remarks/Services/CreatesRemark.php b/app/Classes/Modules/Remarks/Services/CreatesRemark.php new file mode 100644 index 00000000..c4067869 --- /dev/null +++ b/app/Classes/Modules/Remarks/Services/CreatesRemark.php @@ -0,0 +1,32 @@ +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->Remarks(), $model); + + } +} diff --git a/app/Classes/Modules/Remarks/Services/DeletesRemark.php b/app/Classes/Modules/Remarks/Services/DeletesRemark.php new file mode 100644 index 00000000..4c29be9d --- /dev/null +++ b/app/Classes/Modules/Remarks/Services/DeletesRemark.php @@ -0,0 +1,19 @@ +handler($model); + } +} diff --git a/app/Classes/Modules/Remarks/Services/FetchesRemark.php b/app/Classes/Modules/Remarks/Services/FetchesRemark.php new file mode 100644 index 00000000..a3b5c765 --- /dev/null +++ b/app/Classes/Modules/Remarks/Services/FetchesRemark.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Remarks/Services/ListsRemarks.php b/app/Classes/Modules/Remarks/Services/ListsRemarks.php new file mode 100644 index 00000000..53479558 --- /dev/null +++ b/app/Classes/Modules/Remarks/Services/ListsRemarks.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Remarks/Services/UpdatesRemark.php b/app/Classes/Modules/Remarks/Services/UpdatesRemark.php new file mode 100644 index 00000000..082e2281 --- /dev/null +++ b/app/Classes/Modules/Remarks/Services/UpdatesRemark.php @@ -0,0 +1,33 @@ +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(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php new file mode 100644 index 00000000..fc51178f --- /dev/null +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php @@ -0,0 +1,57 @@ +RemarkValidation = $RemarkValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param RemarkObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->RemarkValidation->validate($object); + + } + + + /** + * @param RemarkObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php new file mode 100644 index 00000000..7ddece31 --- /dev/null +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php @@ -0,0 +1,43 @@ +RemarkValidation = $RemarkValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param RemarkObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->RemarkValidation->validate($object); + + } + + + /** + * @param RemarkObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Remarks/Standards/Validators/RemarkValidation.php b/app/Classes/Modules/Remarks/Standards/Validators/RemarkValidation.php new file mode 100644 index 00000000..25c9dfee --- /dev/null +++ b/app/Classes/Modules/Remarks/Standards/Validators/RemarkValidation.php @@ -0,0 +1,42 @@ + $object->getStreetOne(), + 'street_two' => $object->getStreetTwo(), + 'district_id' => $object->getDistrictId() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'street_one' => 'required', + 'district_id' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Classes/Modules/Schedules/ControllersLogic/CreateScheduleLogic.php b/app/Classes/Modules/Schedules/ControllersLogic/CreateScheduleLogic.php new file mode 100644 index 00000000..06ca06a8 --- /dev/null +++ b/app/Classes/Modules/Schedules/ControllersLogic/CreateScheduleLogic.php @@ -0,0 +1,79 @@ + 'Created Schedule', + 'message' => 'You have successfully created a new Schedule' + ]; + } + + /** @var CanCreateSchedule */ + private $canCreateSchedule; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** @var FetchesCompany */ + private $fetchesCompany; + + /** @var CreatesSchedule */ + private $createsSchedule; + + /** + * CreateScheduleLogic constructor. + * @param CanCreateSchedule $canCreateSchedule + * @param FetchesDistrict $fetchesDistrict + * @param FetchesCompany $fetchesCompany + * @param CreatesSchedule $createsSchedule + */ + public function __construct(CanCreateSchedule $canCreateSchedule, FetchesDistrict $fetchesDistrict, FetchesCompany $fetchesCompany, CreatesSchedule $createsSchedule) + { + $this->canCreateSchedule = $canCreateSchedule; + $this->fetchesDistrict = $fetchesDistrict; + $this->fetchesCompany = $fetchesCompany; + $this->createsSchedule = $createsSchedule; + } + + /** + * @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 ScheduleObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + + $this->canCreateSchedule->passes($object); + + $query = $this->createsSchedule->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object); + + return $this->resourceResponse(new ScheduleResource($query)); + + } + +} diff --git a/app/Classes/Modules/Schedules/ControllersLogic/DeleteScheduleLogic.php b/app/Classes/Modules/Schedules/ControllersLogic/DeleteScheduleLogic.php new file mode 100644 index 00000000..2d0f62e7 --- /dev/null +++ b/app/Classes/Modules/Schedules/ControllersLogic/DeleteScheduleLogic.php @@ -0,0 +1,73 @@ + 'Deleted Schedule', + 'message' => 'You have successfully deleted a Schedule' + ]; + } + + + /** @var CanDeleteSchedule */ + private $canDeleteSchedule; + + /** @var DeletesSchedule */ + private $deletesSchedule; + + /** @var FetchesSchedule */ + private $fetchesSchedule; + + /** + * DeleteScheduleControllersLogic constructor. + * @param CanDeleteSchedule $canDeleteSchedule + * @param DeletesSchedule $deletesSchedule + * @param FetchesSchedule $fetchesSchedule + */ + public function __construct(CanDeleteSchedule $canDeleteSchedule, DeletesSchedule $deletesSchedule, FetchesSchedule $fetchesSchedule) + { + $this->canDeleteSchedule = $canDeleteSchedule; + $this->deletesSchedule = $deletesSchedule; + $this->fetchesSchedule = $fetchesSchedule; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canDeleteSchedule->passes(); + + $query = $this->fetchesSchedule->execute(['id' => $request->route('id')]); + + $this->deletesSchedule->execute($query); + + return $this->response([]); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Schedules/ControllersLogic/FetchScheduleLogic.php b/app/Classes/Modules/Schedules/ControllersLogic/FetchScheduleLogic.php new file mode 100644 index 00000000..2c36a0d1 --- /dev/null +++ b/app/Classes/Modules/Schedules/ControllersLogic/FetchScheduleLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Schedule', + 'message' => 'You have successfully retrieved a Schedule' + ]; + } + + /** @var CanFetchSchedule */ + private $canFetchSchedule; + + /** @var FetchesSchedule */ + private $fetchesSchedule; + + /** + * FetchScheduleControllersLogic constructor. + * @param CanFetchSchedule $canFetchSchedule + * @param FetchesSchedule $fetchesSchedule + */ + public function __construct(CanFetchSchedule $canFetchSchedule, FetchesSchedule $fetchesSchedule) + { + $this->canFetchSchedule = $canFetchSchedule; + $this->fetchesSchedule = $fetchesSchedule; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canFetchSchedule->passes(); + + $query = $this->fetchesSchedule->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new ScheduleResource($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Schedules/ControllersLogic/ListSchedulesLogic.php b/app/Classes/Modules/Schedules/ControllersLogic/ListSchedulesLogic.php new file mode 100644 index 00000000..17f4dee8 --- /dev/null +++ b/app/Classes/Modules/Schedules/ControllersLogic/ListSchedulesLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Schedules', + 'message' => 'You have successfully retrieved a list of Schedules' + ]; + } + + /** @var CanListSchedules */ + private $canListSchedules; + + /** @var ListsSchedules */ + private $listsSchedules; + + /** + * ListSchedulesLogic constructor. + * @param CanListSchedules $canListSchedules + * @param ListsSchedules $listsSchedules + */ + public function __construct(CanListSchedules $canListSchedules, ListsSchedules $listsSchedules) + { + $this->canListSchedules = $canListSchedules; + $this->listsSchedules = $listsSchedules; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canListSchedules->passes(); + + $query = $this->listsSchedules->execute($this->listsSchedules->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(ScheduleResource::collection($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Schedules/ControllersLogic/UpdateScheduleLogic.php b/app/Classes/Modules/Schedules/ControllersLogic/UpdateScheduleLogic.php new file mode 100644 index 00000000..b8589cf6 --- /dev/null +++ b/app/Classes/Modules/Schedules/ControllersLogic/UpdateScheduleLogic.php @@ -0,0 +1,86 @@ + 'Updated Schedule', + 'message' => 'You have successfully updated the Schedule' + ]; + } + + /** @var CanUpdateSchedule */ + private $canUpdateSchedule; + + /** @var UpdatesSchedule */ + private $updatesSchedule; + + /** @var FetchesSchedule */ + private $fetchesSchedule; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** + * UpdateScheduleLogic constructor. + * @param CanUpdateSchedule $canUpdateSchedule + * @param UpdatesSchedule $updatesSchedule + * @param FetchesSchedule $fetchesSchedule + * @param FetchesDistrict $fetchesDistrict + */ + public function __construct(CanUpdateSchedule $canUpdateSchedule, UpdatesSchedule $updatesSchedule, FetchesSchedule $fetchesSchedule, FetchesDistrict $fetchesDistrict) + { + $this->canUpdateSchedule = $canUpdateSchedule; + $this->updatesSchedule = $updatesSchedule; + $this->fetchesSchedule = $fetchesSchedule; + $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 ScheduleObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + //$object = new ScheduleObject($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->canUpdateSchedule->passes($object); + + $query = $this->fetchesSchedule->execute(['id' => $request->route('id')]); + + $query = $this->updatesSchedule->execute($query, $object); + + return $this->resourceResponse(new ScheduleResource($query)); + + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Schedules/DataTransferObjects/ScheduleObject.php b/app/Classes/Modules/Schedules/DataTransferObjects/ScheduleObject.php new file mode 100644 index 00000000..9a85301d --- /dev/null +++ b/app/Classes/Modules/Schedules/DataTransferObjects/ScheduleObject.php @@ -0,0 +1,96 @@ +streetOne = $streetOne; + $this->streetTwo = $streetTwo; + $this->countryId = $countryId; + $this->stateId = $stateId; + $this->districtId = $districtId; + $this->postCode = $postCode; + } + + /** + * @return string + */ + public function getStreetOne(): string + { + return $this->streetOne; + } + + /** + * @return null|string + */ + public function getStreetTwo(): ?string + { + return $this->streetTwo; + } + + /** + * @return int + */ + public function getCountryId(): int + { + return $this->countryId; + } + + /** + * @return int + */ + public function getStateId(): int + { + return $this->stateId; + } + + /** + * @return int + */ + public function getDistrictId(): int + { + return $this->districtId; + } + + /** + * @return int + */ + public function getPostCode(): int + { + return $this->postCode; + } + + +} diff --git a/app/Classes/Modules/Schedules/Services/CreatesSchedule.php b/app/Classes/Modules/Schedules/Services/CreatesSchedule.php new file mode 100644 index 00000000..2cb67a6f --- /dev/null +++ b/app/Classes/Modules/Schedules/Services/CreatesSchedule.php @@ -0,0 +1,32 @@ +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->Schedules(), $model); + + } +} diff --git a/app/Classes/Modules/Schedules/Services/DeletesSchedule.php b/app/Classes/Modules/Schedules/Services/DeletesSchedule.php new file mode 100644 index 00000000..cd1368cf --- /dev/null +++ b/app/Classes/Modules/Schedules/Services/DeletesSchedule.php @@ -0,0 +1,19 @@ +handler($model); + } +} diff --git a/app/Classes/Modules/Schedules/Services/FetchesSchedule.php b/app/Classes/Modules/Schedules/Services/FetchesSchedule.php new file mode 100644 index 00000000..eb7e4311 --- /dev/null +++ b/app/Classes/Modules/Schedules/Services/FetchesSchedule.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Schedules/Services/ListsSchedules.php b/app/Classes/Modules/Schedules/Services/ListsSchedules.php new file mode 100644 index 00000000..aeacc9e3 --- /dev/null +++ b/app/Classes/Modules/Schedules/Services/ListsSchedules.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Schedules/Services/UpdatesSchedule.php b/app/Classes/Modules/Schedules/Services/UpdatesSchedule.php new file mode 100644 index 00000000..84e9491c --- /dev/null +++ b/app/Classes/Modules/Schedules/Services/UpdatesSchedule.php @@ -0,0 +1,33 @@ +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(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/Schedules/Standards/Rules/CanCreateSchedule.php b/app/Classes/Modules/Schedules/Standards/Rules/CanCreateSchedule.php new file mode 100644 index 00000000..38dadf18 --- /dev/null +++ b/app/Classes/Modules/Schedules/Standards/Rules/CanCreateSchedule.php @@ -0,0 +1,57 @@ +ScheduleValidation = $ScheduleValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param ScheduleObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->ScheduleValidation->validate($object); + + } + + + /** + * @param ScheduleObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Schedules/Standards/Rules/CanDeleteSchedule.php b/app/Classes/Modules/Schedules/Standards/Rules/CanDeleteSchedule.php new file mode 100644 index 00000000..31b5fb08 --- /dev/null +++ b/app/Classes/Modules/Schedules/Standards/Rules/CanDeleteSchedule.php @@ -0,0 +1,43 @@ +ScheduleValidation = $ScheduleValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param ScheduleObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->ScheduleValidation->validate($object); + + } + + + /** + * @param ScheduleObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Schedules/Standards/Validators/ScheduleValidation.php b/app/Classes/Modules/Schedules/Standards/Validators/ScheduleValidation.php new file mode 100644 index 00000000..4039e0ee --- /dev/null +++ b/app/Classes/Modules/Schedules/Standards/Validators/ScheduleValidation.php @@ -0,0 +1,42 @@ + $object->getStreetOne(), + 'street_two' => $object->getStreetTwo(), + 'district_id' => $object->getDistrictId() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'street_one' => 'required', + 'district_id' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php b/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php new file mode 100644 index 00000000..b3e8d554 --- /dev/null +++ b/app/Classes/Modules/Transports/ControllersLogic/CreateTransportLogic.php @@ -0,0 +1,79 @@ + 'Created Transport', + 'message' => 'You have successfully created a new Transport' + ]; + } + + /** @var CanCreateTransport */ + private $canCreateTransport; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** @var FetchesCompany */ + private $fetchesCompany; + + /** @var CreatesTransport */ + private $createsTransport; + + /** + * CreateTransportLogic constructor. + * @param CanCreateTransport $canCreateTransport + * @param FetchesDistrict $fetchesDistrict + * @param FetchesCompany $fetchesCompany + * @param CreatesTransport $createsTransport + */ + public function __construct(CanCreateTransport $canCreateTransport, FetchesDistrict $fetchesDistrict, FetchesCompany $fetchesCompany, CreatesTransport $createsTransport) + { + $this->canCreateTransport = $canCreateTransport; + $this->fetchesDistrict = $fetchesDistrict; + $this->fetchesCompany = $fetchesCompany; + $this->createsTransport = $createsTransport; + } + + /** + * @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 TransportObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + + $this->canCreateTransport->passes($object); + + $query = $this->createsTransport->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object); + + return $this->resourceResponse(new TransportResource($query)); + + } + +} diff --git a/app/Classes/Modules/Transports/ControllersLogic/DeleteTransportLogic.php b/app/Classes/Modules/Transports/ControllersLogic/DeleteTransportLogic.php new file mode 100644 index 00000000..c21afd27 --- /dev/null +++ b/app/Classes/Modules/Transports/ControllersLogic/DeleteTransportLogic.php @@ -0,0 +1,73 @@ + 'Deleted Transport', + 'message' => 'You have successfully deleted a Transport' + ]; + } + + + /** @var CanDeleteTransport */ + private $canDeleteTransport; + + /** @var DeletesTransport */ + private $deletesTransport; + + /** @var FetchesTransport */ + private $fetchesTransport; + + /** + * DeleteTransportControllersLogic constructor. + * @param CanDeleteTransport $canDeleteTransport + * @param DeletesTransport $deletesTransport + * @param FetchesTransport $fetchesTransport + */ + public function __construct(CanDeleteTransport $canDeleteTransport, DeletesTransport $deletesTransport, FetchesTransport $fetchesTransport) + { + $this->canDeleteTransport = $canDeleteTransport; + $this->deletesTransport = $deletesTransport; + $this->fetchesTransport = $fetchesTransport; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canDeleteTransport->passes(); + + $query = $this->fetchesTransport->execute(['id' => $request->route('id')]); + + $this->deletesTransport->execute($query); + + return $this->response([]); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Transports/ControllersLogic/FetchTransportLogic.php b/app/Classes/Modules/Transports/ControllersLogic/FetchTransportLogic.php new file mode 100644 index 00000000..ed624581 --- /dev/null +++ b/app/Classes/Modules/Transports/ControllersLogic/FetchTransportLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Transport', + 'message' => 'You have successfully retrieved a Transport' + ]; + } + + /** @var CanFetchTransport */ + private $canFetchTransport; + + /** @var FetchesTransport */ + private $fetchesTransport; + + /** + * FetchTransportControllersLogic constructor. + * @param CanFetchTransport $canFetchTransport + * @param FetchesTransport $fetchesTransport + */ + public function __construct(CanFetchTransport $canFetchTransport, FetchesTransport $fetchesTransport) + { + $this->canFetchTransport = $canFetchTransport; + $this->fetchesTransport = $fetchesTransport; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canFetchTransport->passes(); + + $query = $this->fetchesTransport->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new TransportResource($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Transports/ControllersLogic/ListTransportsLogic.php b/app/Classes/Modules/Transports/ControllersLogic/ListTransportsLogic.php new file mode 100644 index 00000000..2d5d1bc5 --- /dev/null +++ b/app/Classes/Modules/Transports/ControllersLogic/ListTransportsLogic.php @@ -0,0 +1,66 @@ + 'Retrieved Transports', + 'message' => 'You have successfully retrieved a list of Transports' + ]; + } + + /** @var CanListTransports */ + private $canListTransports; + + /** @var ListsTransports */ + private $listsTransports; + + /** + * ListTransportsLogic constructor. + * @param CanListTransports $canListTransports + * @param ListsTransports $listsTransports + */ + public function __construct(CanListTransports $canListTransports, ListsTransports $listsTransports) + { + $this->canListTransports = $canListTransports; + $this->listsTransports = $listsTransports; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + + $this->canListTransports->passes(); + + $query = $this->listsTransports->execute($this->listsTransports->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(TransportResource::collection($query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Transports/ControllersLogic/UpdateTransportLogic.php b/app/Classes/Modules/Transports/ControllersLogic/UpdateTransportLogic.php new file mode 100644 index 00000000..b6925003 --- /dev/null +++ b/app/Classes/Modules/Transports/ControllersLogic/UpdateTransportLogic.php @@ -0,0 +1,86 @@ + 'Updated Transport', + 'message' => 'You have successfully updated the Transport' + ]; + } + + /** @var CanUpdateTransport */ + private $canUpdateTransport; + + /** @var UpdatesTransport */ + private $updatesTransport; + + /** @var FetchesTransport */ + private $fetchesTransport; + + /** @var FetchesDistrict */ + private $fetchesDistrict; + + /** + * UpdateTransportLogic constructor. + * @param CanUpdateTransport $canUpdateTransport + * @param UpdatesTransport $updatesTransport + * @param FetchesTransport $fetchesTransport + * @param FetchesDistrict $fetchesDistrict + */ + public function __construct(CanUpdateTransport $canUpdateTransport, UpdatesTransport $updatesTransport, FetchesTransport $fetchesTransport, FetchesDistrict $fetchesDistrict) + { + $this->canUpdateTransport = $canUpdateTransport; + $this->updatesTransport = $updatesTransport; + $this->fetchesTransport = $fetchesTransport; + $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 TransportObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code')); + //$object = new TransportObject($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->canUpdateTransport->passes($object); + + $query = $this->fetchesTransport->execute(['id' => $request->route('id')]); + + $query = $this->updatesTransport->execute($query, $object); + + return $this->resourceResponse(new TransportResource($query)); + + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + + } + +} diff --git a/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php b/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php new file mode 100644 index 00000000..9b90b930 --- /dev/null +++ b/app/Classes/Modules/Transports/DataTransferObjects/TransportObject.php @@ -0,0 +1,96 @@ +streetOne = $streetOne; + $this->streetTwo = $streetTwo; + $this->countryId = $countryId; + $this->stateId = $stateId; + $this->districtId = $districtId; + $this->postCode = $postCode; + } + + /** + * @return string + */ + public function getStreetOne(): string + { + return $this->streetOne; + } + + /** + * @return null|string + */ + public function getStreetTwo(): ?string + { + return $this->streetTwo; + } + + /** + * @return int + */ + public function getCountryId(): int + { + return $this->countryId; + } + + /** + * @return int + */ + public function getStateId(): int + { + return $this->stateId; + } + + /** + * @return int + */ + public function getDistrictId(): int + { + return $this->districtId; + } + + /** + * @return int + */ + public function getPostCode(): int + { + return $this->postCode; + } + + +} diff --git a/app/Classes/Modules/Transports/Services/CreatesTransport.php b/app/Classes/Modules/Transports/Services/CreatesTransport.php new file mode 100644 index 00000000..80a08a16 --- /dev/null +++ b/app/Classes/Modules/Transports/Services/CreatesTransport.php @@ -0,0 +1,32 @@ +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); + + } +} diff --git a/app/Classes/Modules/Transports/Services/DeletesTransport.php b/app/Classes/Modules/Transports/Services/DeletesTransport.php new file mode 100644 index 00000000..b75d7db3 --- /dev/null +++ b/app/Classes/Modules/Transports/Services/DeletesTransport.php @@ -0,0 +1,19 @@ +handler($model); + } +} diff --git a/app/Classes/Modules/Transports/Services/FetchesTransport.php b/app/Classes/Modules/Transports/Services/FetchesTransport.php new file mode 100644 index 00000000..2d507237 --- /dev/null +++ b/app/Classes/Modules/Transports/Services/FetchesTransport.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Transports/Services/ListsTransports.php b/app/Classes/Modules/Transports/Services/ListsTransports.php new file mode 100644 index 00000000..904dab0f --- /dev/null +++ b/app/Classes/Modules/Transports/Services/ListsTransports.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Classes/Modules/Transports/Services/UpdatesTransport.php b/app/Classes/Modules/Transports/Services/UpdatesTransport.php new file mode 100644 index 00000000..155e793d --- /dev/null +++ b/app/Classes/Modules/Transports/Services/UpdatesTransport.php @@ -0,0 +1,33 @@ +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(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/Transports/Standards/Rules/CanCreateTransport.php b/app/Classes/Modules/Transports/Standards/Rules/CanCreateTransport.php new file mode 100644 index 00000000..a7e41ea1 --- /dev/null +++ b/app/Classes/Modules/Transports/Standards/Rules/CanCreateTransport.php @@ -0,0 +1,57 @@ +TransportValidation = $TransportValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param TransportObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->TransportValidation->validate($object); + + } + + + /** + * @param TransportObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Transports/Standards/Rules/CanDeleteTransport.php b/app/Classes/Modules/Transports/Standards/Rules/CanDeleteTransport.php new file mode 100644 index 00000000..1d1e94ab --- /dev/null +++ b/app/Classes/Modules/Transports/Standards/Rules/CanDeleteTransport.php @@ -0,0 +1,43 @@ +TransportValidation = $TransportValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param TransportObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->TransportValidation->validate($object); + + } + + + /** + * @param TransportObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} diff --git a/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php b/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php new file mode 100644 index 00000000..83737634 --- /dev/null +++ b/app/Classes/Modules/Transports/Standards/Validators/TransportValidation.php @@ -0,0 +1,42 @@ + $object->getStreetOne(), + 'street_two' => $object->getStreetTwo(), + 'district_id' => $object->getDistrictId() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'street_one' => 'required', + 'district_id' => 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} diff --git a/app/Http/Controllers/Remarks/CreateRemarkController.php b/app/Http/Controllers/Remarks/CreateRemarkController.php index 530e2737..313a25b6 100644 --- a/app/Http/Controllers/Remarks/CreateRemarkController.php +++ b/app/Http/Controllers/Remarks/CreateRemarkController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Remarks/DeleteRemarkController.php b/app/Http/Controllers/Remarks/DeleteRemarkController.php index ab38015e..aa292c48 100644 --- a/app/Http/Controllers/Remarks/DeleteRemarkController.php +++ b/app/Http/Controllers/Remarks/DeleteRemarkController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Remarks/FetchRemarkController.php b/app/Http/Controllers/Remarks/FetchRemarkController.php index c9319712..b5c31024 100644 --- a/app/Http/Controllers/Remarks/FetchRemarkController.php +++ b/app/Http/Controllers/Remarks/FetchRemarkController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Remarks/ListRemarksController.php b/app/Http/Controllers/Remarks/ListRemarksController.php index fded91e7..85d16ff6 100644 --- a/app/Http/Controllers/Remarks/ListRemarksController.php +++ b/app/Http/Controllers/Remarks/ListRemarksController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Remarks/UpdateRemarkController.php b/app/Http/Controllers/Remarks/UpdateRemarkController.php index dcc60dc0..b18efcf7 100644 --- a/app/Http/Controllers/Remarks/UpdateRemarkController.php +++ b/app/Http/Controllers/Remarks/UpdateRemarkController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Schedules/CreateScheduleController.php b/app/Http/Controllers/Schedules/CreateScheduleController.php index 530e2737..ff154ee1 100644 --- a/app/Http/Controllers/Schedules/CreateScheduleController.php +++ b/app/Http/Controllers/Schedules/CreateScheduleController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Schedules/DeleteScheduleController.php b/app/Http/Controllers/Schedules/DeleteScheduleController.php index ab38015e..de9d178c 100644 --- a/app/Http/Controllers/Schedules/DeleteScheduleController.php +++ b/app/Http/Controllers/Schedules/DeleteScheduleController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Schedules/FetchScheduleController.php b/app/Http/Controllers/Schedules/FetchScheduleController.php index c9319712..6f393e6a 100644 --- a/app/Http/Controllers/Schedules/FetchScheduleController.php +++ b/app/Http/Controllers/Schedules/FetchScheduleController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Schedules/ListSchedulesController.php b/app/Http/Controllers/Schedules/ListSchedulesController.php index fded91e7..996b0d1d 100644 --- a/app/Http/Controllers/Schedules/ListSchedulesController.php +++ b/app/Http/Controllers/Schedules/ListSchedulesController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Schedules/UpdateScheduleController.php b/app/Http/Controllers/Schedules/UpdateScheduleController.php index dcc60dc0..80a630c2 100644 --- a/app/Http/Controllers/Schedules/UpdateScheduleController.php +++ b/app/Http/Controllers/Schedules/UpdateScheduleController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Transports/CreateTransportController.php b/app/Http/Controllers/Transports/CreateTransportController.php index 530e2737..e9b179ed 100644 --- a/app/Http/Controllers/Transports/CreateTransportController.php +++ b/app/Http/Controllers/Transports/CreateTransportController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Transports/DeleteTransportController.php b/app/Http/Controllers/Transports/DeleteTransportController.php index ab38015e..4b4fe378 100644 --- a/app/Http/Controllers/Transports/DeleteTransportController.php +++ b/app/Http/Controllers/Transports/DeleteTransportController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Transports/FetchTransportController.php b/app/Http/Controllers/Transports/FetchTransportController.php index c9319712..7ab2b449 100644 --- a/app/Http/Controllers/Transports/FetchTransportController.php +++ b/app/Http/Controllers/Transports/FetchTransportController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Transports/ListTransportsController.php b/app/Http/Controllers/Transports/ListTransportsController.php index fded91e7..8050ca13 100644 --- a/app/Http/Controllers/Transports/ListTransportsController.php +++ b/app/Http/Controllers/Transports/ListTransportsController.php @@ -1,8 +1,8 @@ execute($request); } diff --git a/app/Http/Controllers/Transports/UpdateTransportController.php b/app/Http/Controllers/Transports/UpdateTransportController.php index dcc60dc0..28704686 100644 --- a/app/Http/Controllers/Transports/UpdateTransportController.php +++ b/app/Http/Controllers/Transports/UpdateTransportController.php @@ -1,8 +1,8 @@ execute($request); }