account, $this->serializer); return $this->includeCollection($vendor->vendorContacts, $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 includeExpenses(Vendor $vendor) { $transformer = new ExpenseTransformer($this->account, $this->serializer); return $this->includeCollection($vendor->expenses, $transformer, ENTITY_EXPENSE); } 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, 'is_deleted' => (bool) $vendor->is_deleted, 'vat_number' => $vendor->vat_number, 'id_number' => $vendor->id_number, 'currency_id' => (int) $vendor->currency_id ]; } }