mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-30 01:44:05 +00:00
address extra fields
This commit is contained in:
@@ -27,6 +27,9 @@ class AddressResource extends JsonResource
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
||||
|
||||
$extrafields = json_decode($this->addressExtraFields->first());
|
||||
$extrafields = $extrafields ? (isset($extrafields->content) ? json_decode($extrafields->content) : null) : null;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
@@ -43,6 +46,11 @@ class AddressResource extends JsonResource
|
||||
'contact' => new ContactResource($this->contacts->first()),
|
||||
'remark' => new RemarkResource($this->remarks->first()),
|
||||
'type' => $this->type,
|
||||
'extrafields' => $extrafields,
|
||||
'property_type' => $extrafields ? $extrafields->property_type : null,
|
||||
'tools_required_unload' => $extrafields ? $extrafields->tools_required_unload : null,
|
||||
'pickup_time_from' => $extrafields ? $extrafields->pickup_time_from : null,
|
||||
'pickup_time_to' => $extrafields ? $extrafields->pickup_time_to : null,
|
||||
$this->mergeWhen($this->relationLoaded('owner'), [
|
||||
'owner' => $this->when($this->owner instanceof Order, [
|
||||
'reference' => $this->owner->reference,
|
||||
|
||||
Reference in New Issue
Block a user