2026-02-06 11:56:29 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Modules\Integration\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
|
|
|
|
class SalesOrder extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'sales_orders';
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'external_order_id',
|
|
|
|
|
'status',
|
|
|
|
|
'payment_method',
|
|
|
|
|
'total_amount',
|
|
|
|
|
'sold_at',
|
|
|
|
|
'raw_payload',
|
2026-02-23 13:27:12 +08:00
|
|
|
'source',
|
|
|
|
|
'source_label',
|
2026-02-06 11:56:29 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'sold_at' => 'datetime',
|
|
|
|
|
'raw_payload' => 'array',
|
|
|
|
|
'total_amount' => 'decimal:4',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function items(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(SalesOrderItem::class);
|
|
|
|
|
}
|
|
|
|
|
}
|