mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-24 06:54:09 +00:00
address extra fields
This commit is contained in:
@@ -27,7 +27,11 @@ class AddressResource extends JsonResource
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
||||
|
||||
return [
|
||||
// Handle extra fields
|
||||
$extrafields = $this->addressExtraFields->first();
|
||||
$extrafields = $extrafields ? json_decode($extrafields->content, true) : [];
|
||||
|
||||
$returnArray = [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
'street_one' => $this->street_one,
|
||||
@@ -52,5 +56,12 @@ class AddressResource extends JsonResource
|
||||
])
|
||||
|
||||
];
|
||||
|
||||
// Merge extra fields into the return array
|
||||
if ($extrafields) {
|
||||
$returnArray = array_merge($returnArray, $extrafields);
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user