Merge pull request #4009 from JunaidJaved8461/JJ

Fixed #3974 (Validation Message Shown now)
This commit is contained in:
Jitendra Singh 2020-10-12 12:43:21 +05:30 committed by GitHub
commit e08d41ae0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -103,23 +103,19 @@ 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']);
}
if (!isset($data['password']) || ! $data['password']) {
if (! isset($data['password']) || ! $data['password']) {
unset($data['password']);
} else {
$data['password'] = bcrypt($data['password']);
}
$this->customerRepository->update($data, $customer->id);
$updatedCustomer = $this->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($updatedCustomer),
]);
}
@ -136,4 +132,4 @@ class SessionController extends Controller
'message' => 'Logged out successfully.',
]);
}
}
}