payment_purpose !== null) { return $this->payment_purpose; } $subject = $this->type === InvoiceType::INVOICE_TYPE_PARTICIPATION_REFUND ? 'Beitragserstattung' : 'Auslagenerstattung'; return $subject . ' Belegnummer ' . $this->invoice_number; } public function costUnit() : BelongsTo{ return $this->belongsTo(CostUnit::class); } public function status() : BelongsTo { return $this->belongsTo(InvoiceStatus::class, 'status')->first(); } public function invoiceType() : InvoiceType { return $this->belongsTo(InvoiceType::class, 'type', 'slug')->first(); } public function approvedBy() : ?User { return $this->belongsTo(User::class, 'approved_by')->first(); } }