$this->id, 'reference' => $this->reference, 'type' => (int) $this->type, 'status' => (int) $this->status, 'company_module' => new CompanyModuleResource($this->companyModule), 'sender_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::PICK_UP)->first()), 'delivery_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::DELIVERY)->first()), 'packingList' => new DeliveryPackingListResource($this->packingLists()->first()), 'remarks' => RemarkResource::collection($this->remarks), 'created_at' => $this->created_at->format('d-m-Y') ]; } }