From 3f5238bc4388aa446b87be9e5d3e203eb6ee2a19 Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Thu, 20 Aug 2026 21:51:21 +0200 Subject: [PATCH] feat(contacts): fresh portal dashboard and profile controllers --- .../CustomerPortal/DashboardController.php | 28 ++++++++++ .../CustomerPortal/ProfileController.php | 52 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 app/Domains/Contacts/Http/Controllers/CustomerPortal/DashboardController.php create mode 100644 app/Domains/Contacts/Http/Controllers/CustomerPortal/ProfileController.php 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()); + } +}