diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyContactNumberLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyContactNumberLogic.php new file mode 100644 index 00000000..1a3ec283 --- /dev/null +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyContactNumberLogic.php @@ -0,0 +1,67 @@ + 'Updated Company Contact Number', + 'message' => 'You have successfully updated the Company Contact Number' + ]; + } + + /** @var FetchesContact */ + private $fetchesContact; + + /** @var UpdatesContact */ + private $updatesContact; + + /** + * UpdateCompanyControllersLogic constructor. + * @param FetchesContact $fetchesContact + * @param UpdatesContact $updatesContact + */ + public function __construct(FetchesContact $fetchesContact, UpdatesContact $updatesContact) + { + $this->fetchesContact = $fetchesContact; + $this->updatesContact = $updatesContact; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + $query = $this->fetchesContact->execute(['id' => $request->input('id')]); + + $contact = new ContactObject( + $query->first()->reference, + $request->input('contactNumber'), + $query->first()->email, + $query->first()->wechat_id + ); + + $this->updatesContact->execute($query, $contact); + + return $this->resourceResponse(new ContactResource($query)); + + } + +} diff --git a/app/Http/Controllers/Companies/UpdateCompanyContactNumberController.php b/app/Http/Controllers/Companies/UpdateCompanyContactNumberController.php new file mode 100644 index 00000000..e7920b8e --- /dev/null +++ b/app/Http/Controllers/Companies/UpdateCompanyContactNumberController.php @@ -0,0 +1,21 @@ +execute($request); + } +} diff --git a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue index 0bf4edba..f99262b9 100644 --- a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue +++ b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue @@ -118,7 +118,15 @@