collection($invoice->invoice_items, new InvoiceItemTransformer); } public function transform(Invoice $invoice) { return [ 'id' => (int) $invoice->public_id, 'invoice_number' => $invoice->invoice_number, 'amount' => (float) $invoice->amount, 'balance' => (float) $invoice->balance, ]; } }