serializer = $serializer; } public function includeInvoices(Payment $payment) { $transformer = new InvoiceTransformer($this->serializer); return $this->includeCollection($payment->invoices, $transformer, Invoice::class); } public function includeClient(Payment $payment) { $transformer = new ClientTransformer($this->serializer); return $this->includeItem($payment->client, $transformer, Client::class); } //todo incomplete public function transform(Payment $payment) { return [ 'id' => $this->encodePrimaryKey($payment->id), 'user_id' => $this->encodePrimaryKey($payment->user_id), 'assigned_user_id' => $this->encodePrimaryKey($payment->assigned_user_id), 'amount' => (float) $payment->amount, 'transaction_reference' => $payment->transaction_reference ?: '', 'payment_date' => $payment->payment_date ?: '', 'updated_at' => $payment->updated_at, 'archived_at' => $payment->deleted_at, 'is_deleted' => (bool) $payment->is_deleted, 'payment_type_id' => (string) $payment->payment_type_id ?: '', 'invitation_id' => (string) $payment->invitation_id ?: '', 'client_id' => (string) $this->encodePrimaryKey($payment->client_id), /* 'private_notes' => $payment->private_notes ?: '', 'exchange_rate' => (float) $payment->exchange_rate, 'exchange_currency_id' => (int) $payment->exchange_currency_id, 'refunded' => (float) $payment->refunded, 'payment_status_id' => (string) $payment->payment_status_id, */ ]; } }