From 5c31f067a2740af614e37fe45507b1bfdfc18a86 Mon Sep 17 00:00:00 2001 From: weichien Date: Fri, 19 Mar 2021 07:10:32 +0800 Subject: [PATCH] fix: [BE] return default billing address to billing detail on MyTransfer. --- app/Http/Resources/CompanyResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php index 1cc465aa..3893e5dc 100644 --- a/app/Http/Resources/CompanyResource.php +++ b/app/Http/Resources/CompanyResource.php @@ -29,7 +29,7 @@ class CompanyResource extends JsonResource 'business_type' => (int) $this->business_type, 'status' => (int) $this->status, 'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())), - 'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->first())), + 'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('billing', true)->first())), 'employee' => new UserResource($this->employees->first()), 'identification' => new DocumentResource($this->whenLoaded('documents', $this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first())), 'bookings' => BookingResource::collection($this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), [])),