VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard. Co-authored-by: Cursor <cursoragent@cursor.com>
63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class HostingBillingInvoice extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const TYPE_PLAN_CHANGE = 'plan_change';
|
|
public const TYPE_EMAIL_ADDON = 'email_addon';
|
|
public const TYPE_RENEWAL = 'renewal';
|
|
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_PAID = 'paid';
|
|
public const STATUS_CREDITED = 'credited';
|
|
public const STATUS_WAIVED = 'waived';
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'hosting_account_id',
|
|
'hosting_plan_change_id',
|
|
'invoice_type',
|
|
'status',
|
|
'currency',
|
|
'subtotal_amount',
|
|
'credit_amount',
|
|
'total_amount',
|
|
'description',
|
|
'provider_reference',
|
|
'paid_at',
|
|
'line_items',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'subtotal_amount' => 'decimal:2',
|
|
'credit_amount' => 'decimal:2',
|
|
'total_amount' => 'decimal:2',
|
|
'paid_at' => 'datetime',
|
|
'line_items' => 'array',
|
|
'metadata' => 'array',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function account(): BelongsTo
|
|
{
|
|
return $this->belongsTo(HostingAccount::class, 'hosting_account_id');
|
|
}
|
|
|
|
public function planChange(): BelongsTo
|
|
{
|
|
return $this->belongsTo(HostingPlanChange::class, 'hosting_plan_change_id');
|
|
}
|
|
}
|