collection($client->contacts, new ContactTransformer); } public function includeInvoices($client) { return $this->collection($client->invoices, new InvoiceTransformer); } public function transform(Client $client) { return [ 'id' => (int) $client->public_id, 'name' => $client->name, 'balance' => (float) $client->balance, 'paid_to_date' => (float) $client->paid_to_date, ]; } }