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] 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)), ]); }