Merge pull request #4008 from vishal-webkul/issue-3981

Issue #3981 fixed
This commit is contained in:
Jitendra Singh 2020-10-07 12:34:30 +05:30 committed by GitHub
commit 2a61c3c900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -69,10 +69,18 @@ class AddressController extends Controller
{
$customer = auth($this->guard)->user();
request()->merge([
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
'customer_id' => $customer->id,
]);
if (request()->input('address1') && ! is_array(json_decode(request()->input('address1')))) {
return response()->json([
'message' => 'address1 must be an array.',
]);
}
if (request()->input('address1')) {
request()->merge([
'address1' => implode(PHP_EOL, array_filter(json_decode(request()->input('address1')))),
'customer_id' => $customer->id,
]);
}
$this->validate(request(), [
'address1' => 'string|required',