55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Portal;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class LegacyInvoice extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'legacy_portal',
|
|
'legacy_id',
|
|
'user_id',
|
|
'legacy_user_id',
|
|
'number',
|
|
'amount_cents',
|
|
'tax_cents',
|
|
'total_cents',
|
|
'status',
|
|
'invoice_date',
|
|
'due_date',
|
|
'paid_at',
|
|
'payment_method',
|
|
'pdf_path',
|
|
'raw_snapshot',
|
|
'pdf_payload',
|
|
'pdf_generated_at',
|
|
'imported_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'legacy_portal' => Portal::class,
|
|
'amount_cents' => 'integer',
|
|
'tax_cents' => 'integer',
|
|
'total_cents' => 'integer',
|
|
'invoice_date' => 'date',
|
|
'due_date' => 'date',
|
|
'paid_at' => 'datetime',
|
|
'raw_snapshot' => 'array',
|
|
'pdf_payload' => 'array',
|
|
'pdf_generated_at' => 'datetime',
|
|
'imported_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|