From 340f51cd63451eb05372c97b6e13183b84e3f2d2 Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Tue, 6 Oct 2020 11:30:07 +0500 Subject: [PATCH 1/6] Fixed #3974 (Validation Message Shown now) --- .../API/Http/Controllers/Shop/SessionController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index 19370d917..d75f27b94 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -115,11 +115,11 @@ class SessionController extends Controller $data['password'] = bcrypt($data['password']); } - $this->customerRepository->update($data, $customer->id); + $customerRepository->update($data, $customer->id); return response()->json([ - 'message' => 'Your account has been created successfully.', - 'data' => new CustomerResource($this->customerRepository->find($customer->id)), + 'message' => 'Your account has been updated successfully.', + 'data' => new CustomerResource($customerRepository->find($customer->id)), ]); } @@ -136,4 +136,4 @@ class SessionController extends Controller 'message' => 'Logged out successfully.', ]); } -} \ No newline at end of file +} From ea6d36d7761f6fe7ef0bde6c27b885448bf1a4f2 Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Fri, 9 Oct 2020 10:32:47 +0500 Subject: [PATCH 2/6] UnDefined Variable Issue Resolved Undefined Variable $customerRepository resolved now!! --- .../Webkul/API/Http/Controllers/Shop/SessionController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index d75f27b94..f0f4f2450 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -115,11 +115,11 @@ class SessionController extends Controller $data['password'] = bcrypt($data['password']); } - $customerRepository->update($data, $customer->id); + $this->customerRepository->update($data, $customer->id); return response()->json([ 'message' => 'Your account has been updated successfully.', - 'data' => new CustomerResource($customerRepository->find($customer->id)), + 'data' => new CustomerResource($this->customerRepository->find($customer->id)), ]); } From bc489900a1d606b0bdca03fb140c5fd96bd3bb33 Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Sat, 10 Oct 2020 00:28:08 +0500 Subject: [PATCH 3/6] Issue Resolved Only updating Required request fields now!! I have checked the date_of_birth Issue from my end!! Its fine!! You can check it again I hope it will fine now --- packages/Webkul/API/Http/Controllers/Shop/SessionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index f0f4f2450..eb9c34702 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -103,7 +103,7 @@ class SessionController extends Controller 'password' => 'confirmed|min:6', ]); - $data = request()->all(); + $data = request()->only('first_name','last_name','gender','date_of_birth','email','password'); if (! $data['date_of_birth']) { unset($data['date_of_birth']); From 45cd9d78406baeb15059482b27cb324090346a94 Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Mon, 12 Oct 2020 10:29:50 +0500 Subject: [PATCH 4/6] Defined Minor Changes Done!! --- .../API/Http/Controllers/Shop/SessionController.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index eb9c34702..35dcbdb1d 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -38,6 +38,9 @@ class SessionController extends Controller $this->_config = request('_config'); $this->customerRepository = $customerRepository; + + $this->updatedCustomer = $customerRepository; + } /** @@ -103,11 +106,7 @@ class SessionController extends Controller 'password' => 'confirmed|min:6', ]); - $data = request()->only('first_name','last_name','gender','date_of_birth','email','password'); - - if (! $data['date_of_birth']) { - unset($data['date_of_birth']); - } + $data = request()->only('first_name', 'last_name', 'gender', 'date_of_birth', 'email', 'password'); if (!isset($data['password']) || ! $data['password']) { unset($data['password']); @@ -115,11 +114,11 @@ class SessionController extends Controller $data['password'] = bcrypt($data['password']); } - $this->customerRepository->update($data, $customer->id); + $this->updatedCustomer->update($data, $customer->id); return response()->json([ 'message' => 'Your account has been updated successfully.', - 'data' => new CustomerResource($this->customerRepository->find($customer->id)), + 'data' => new CustomerResource($this->updatedCustomer->find($customer->id)), ]); } From 87ba9e970accc48741c322b2ea17861648f138f9 Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Mon, 12 Oct 2020 11:03:14 +0500 Subject: [PATCH 5/6] !!!Done!!! --- .../Webkul/API/Http/Controllers/Shop/SessionController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index 35dcbdb1d..95ebd8846 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -39,8 +39,6 @@ class SessionController extends Controller $this->customerRepository = $customerRepository; - $this->updatedCustomer = $customerRepository; - } /** @@ -114,11 +112,11 @@ class SessionController extends Controller $data['password'] = bcrypt($data['password']); } - $this->updatedCustomer->update($data, $customer->id); + $updatedCustomer = $this->customerRepository->update($data, $customer->id); return response()->json([ 'message' => 'Your account has been updated successfully.', - 'data' => new CustomerResource($this->updatedCustomer->find($customer->id)), + 'data' => new CustomerResource($updatedCustomer), ]); } From 80d5c4c5a0986eb7f43e8c40aa39ddb013c6613e Mon Sep 17 00:00:00 2001 From: JunaidJaved8461 <72268940+JunaidJaved8461@users.noreply.github.com> Date: Mon, 12 Oct 2020 12:04:47 +0500 Subject: [PATCH 6/6] check now please --- .../Webkul/API/Http/Controllers/Shop/SessionController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php index 95ebd8846..b84f3694d 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/SessionController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/SessionController.php @@ -38,7 +38,6 @@ class SessionController extends Controller $this->_config = request('_config'); $this->customerRepository = $customerRepository; - } /** @@ -106,7 +105,7 @@ class SessionController extends Controller $data = request()->only('first_name', 'last_name', 'gender', 'date_of_birth', 'email', 'password'); - if (!isset($data['password']) || ! $data['password']) { + if (! isset($data['password']) || ! $data['password']) { unset($data['password']); } else { $data['password'] = bcrypt($data['password']);