Giant Update

This commit is contained in:
Wian Drs
2026-07-31 13:57:11 +07:00
parent f68d967c8b
commit b0d08211ec
112 changed files with 6674 additions and 3 deletions
+69
View File
@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends Model
{
use SoftDeletes;
protected $guarded = ['id'];
protected function casts(): array
{
return [
'period_start' => 'date',
'period_end' => 'date',
'issue_date' => 'date',
'send_date' => 'date',
'warning_date' => 'date',
'isolation_date' => 'date',
'subtotal' => 'decimal:2',
'tax_rate' => 'decimal:2',
'tax_amount' => 'decimal:2',
'total' => 'decimal:2',
'paid_amount' => 'decimal:2',
'balance' => 'decimal:2',
'paid_at' => 'datetime',
'profile_snapshot' => 'array',
'metadata' => 'array',
];
}
public function tenant()
{
return $this->belongsTo(Tenant::class);
}
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function billingProfile()
{
return $this->belongsTo(BillingProfile::class);
}
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function updater()
{
return $this->belongsTo(User::class, 'updated_by');
}
public function payer()
{
return $this->belongsTo(User::class, 'paid_by');
}
public function paymentTransactions()
{
return $this->hasMany(PaymentTransaction::class);
}
}