serializer = $serializer; } public function transform(Paymentable $paymentable) { return [ 'id' => $this->encodePrimaryKey($paymentable->id), 'invoice_id' => $this->encodePrimaryKey($paymentable->paymentable_id), 'amount' => (float)$paymentable->amount, ]; } }