'decimal:2', ]; public function invoice() { return $this->belongsTo(Invoice::class); } public function reference() { return $this->morphTo(); } public function gateway() { return $this->belongsTo(Gateway::class); } public function total() { return $this->price * $this->quantity; } public function formattedTotal(): Attribute { return Attribute::make( get: fn () => new Price(['price' => $this->total(), 'currency' => $this->invoice->currency]) ); } public function formattedPrice(): Attribute { return Attribute::make( get: fn () => new Price(['price' => $this->price, 'currency' => $this->invoice->currency]) ); } }