account, $this->serializer); return $this->includeCollection($vendor->contacts, $transformer, ENTITY_CONTACT); } public function includeInvoices(Vendor $vendor) { $transformer = new InvoiceTransformer($this->account, $this->serializer); return $this->includeCollection($vendor->invoices, $transformer, ENTITY_INVOICE); } public function transform(Vendor $vendor) { return [ 'id' => (int) $vendor->public_id, 'name' => $vendor->name, 'balance' => (float) $vendor->balance, 'paid_to_date' => (float) $vendor->paid_to_date, 'user_id' => (int) $vendor->user->public_id + 1, 'account_key' => $this->account->account_key, 'updated_at' => $this->getTimestamp($vendor->updated_at), 'archived_at' => $this->getTimestamp($vendor->deleted_at), 'address1' => $vendor->address1, 'address2' => $vendor->address2, 'city' => $vendor->city, 'state' => $vendor->state, 'postal_code' => $vendor->postal_code, 'country_id' => (int) $vendor->country_id, 'work_phone' => $vendor->work_phone, 'private_notes' => $vendor->private_notes, 'last_login' => $vendor->last_login, 'website' => $vendor->website, 'industry_id' => (int) $vendor->industry_id, 'size_id' => (int) $vendor->size_id, 'is_deleted' => (bool) $vendor->is_deleted, 'payment_terms' => (int) $vendor->payment_terms, 'vat_number' => $vendor->vat_number, 'id_number' => $vendor->id_number, 'language_id' => (int) $vendor->language_id, 'currency_id' => (int) $vendor->currency_id ]; } }