diff --git a/app/Domains/Contacts/Http/Controllers/CustomerPortal/DashboardController.php b/app/Domains/Contacts/Http/Controllers/CustomerPortal/DashboardController.php new file mode 100644 index 00000000..7050f020 --- /dev/null +++ b/app/Domains/Contacts/Http/Controllers/CustomerPortal/DashboardController.php @@ -0,0 +1,28 @@ +json( + $this->customerPortalDashboardProvider->get(Auth::guard('customer')->user()) + ); + } +} diff --git a/app/Domains/Contacts/Http/Controllers/CustomerPortal/ProfileController.php b/app/Domains/Contacts/Http/Controllers/CustomerPortal/ProfileController.php new file mode 100644 index 00000000..a3530019 --- /dev/null +++ b/app/Domains/Contacts/Http/Controllers/CustomerPortal/ProfileController.php @@ -0,0 +1,52 @@ +user(); + + $customer = $this->customerService->updateProfile( + customer: $customer, + attributes: $request->customerAttributes(), + shippingAddress: $request->shippingAddress(), + billingAddress: $request->billingAddress(), + ); + + if ((bool) $request->validated('is_customer_avatar_removed', false)) { + $this->customerAvatarManager->clear($customer); + } + + $avatar = $request->file('customer_avatar'); + + if ($avatar) { + $this->customerAvatarManager->replace( + $customer, + $avatar->getPathname(), + $avatar->getClientOriginalName(), + ); + } + + return CustomerResource::make($customer); + } + + public function getUser(Request $request) + { + return CustomerResource::make(auth('customer')->user()); + } +}