Files
ladill-hosting/app/Models/RcServiceOrder.php
T
isaaccladandCursor d532f5b206
Deploy Ladill Hosting / deploy (push) Successful in 23s
Fix legacy RC hosting orders not appearing after app extraction.
Import RC service orders in hosting:import, map platform_id on legacy models, and wire legacy order manage links to hosting.legacy.show.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 20:31:29 +00:00

95 lines
2.8 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class RcServiceOrder extends Model
{
use HasFactory;
public const TYPE_SERVICE = 'service';
public const TYPE_DOMAIN_REGISTRATION = 'domain_registration';
public const TYPE_DOMAIN_TRANSFER = 'domain_transfer';
public const TYPE_RENEWAL = 'renewal';
public const STATUS_CART = 'cart';
public const STATUS_PENDING_PAYMENT = 'pending_payment';
public const STATUS_PENDING = 'pending';
public const STATUS_PROCESSING = 'processing';
public const STATUS_ACTIVE = 'active';
public const STATUS_SUSPENDED = 'suspended';
public const STATUS_CANCELLED = 'cancelled';
public const STATUS_EXPIRED = 'expired';
public const STATUS_FAILED = 'failed';
public const PAYMENT_STATUS_UNPAID = 'unpaid';
public const PAYMENT_STATUS_PENDING = 'pending';
public const PAYMENT_STATUS_PAID = 'paid';
public const PAYMENT_STATUS_FAILED = 'failed';
public const PAYMENT_STATUS_REFUNDED = 'refunded';
public const FULFILLMENT_CART = 'cart';
public const FULFILLMENT_PAYMENT_PENDING = 'payment_pending';
public const FULFILLMENT_PAYMENT_RECEIVED = 'payment_received';
public const FULFILLMENT_SUBMITTING = 'submitting';
public const FULFILLMENT_AWAITING_VENDOR = 'awaiting_vendor';
public const FULFILLMENT_MANUAL_REVIEW = 'manual_review';
public const FULFILLMENT_FULFILLED = 'fulfilled';
public const FULFILLMENT_FAILED = 'failed';
protected $fillable = [
'platform_id',
'user_id',
'category',
'order_type',
'domain_name',
'rc_order_id',
'rc_customer_id',
'plan_id',
'plan_name',
'status',
'payment_status',
'fulfillment_status',
'payment_reference',
'amount_minor',
'currency',
'term_months',
'term_years',
'server_location',
'ip_address',
'access_url',
'access_username',
'expires_at',
'paid_at',
'submitted_at',
'last_synced_at',
'provisioned_at',
'meta',
];
protected $casts = [
'amount_minor' => 'integer',
'term_months' => 'integer',
'term_years' => 'integer',
'expires_at' => 'datetime',
'paid_at' => 'datetime',
'submitted_at' => 'datetime',
'last_synced_at' => 'datetime',
'provisioned_at' => 'datetime',
'meta' => 'array',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function scopeVisibleToCustomer($query)
{
return $query->whereNotIn('status', [self::STATUS_CART, self::STATUS_PENDING_PAYMENT]);
}
}