Add initial Code
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-10-20 08:57:51 +02:00
parent d204098d8e
commit 8703e5ff40
449 changed files with 34565 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Customer;
use App\Models\LineItem;
class Invoice extends Model
{
use HasFactory;
protected $fillable = [
'nr',
'invoice_date',
'due_date',
'service_start_date',
'service_end_date',
'is_recurring',
'is_partial_service',
'customer_id',
'billing_data',
'payment_status',
'total_amount',
'title',
'text',
'items'
];
protected $casts = [
'billing_data' => 'array', // JSON to Array
];
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function items()
{
return $this->hasMany(LineItem::class);
}
/**
* Get the payment term for the invoice.
*/
public function getPaymentTermsAttribute()
{
return $this->customer->paymentTerms;
}
}