chore: init saasshop repo + sql migrations runner + gitee go
This commit is contained in:
53
app/Models/PlatformOrder.php
Normal file
53
app/Models/PlatformOrder.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PlatformOrder extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id', 'plan_id', 'site_subscription_id', 'created_by_admin_id', 'order_no', 'order_type', 'status',
|
||||
'payment_status', 'payment_channel', 'plan_name', 'billing_cycle', 'period_months', 'quantity', 'list_amount',
|
||||
'discount_amount', 'payable_amount', 'paid_amount', 'placed_at', 'paid_at', 'activated_at', 'cancelled_at',
|
||||
'refunded_at', 'plan_snapshot', 'meta', 'remark',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'list_amount' => 'decimal:2',
|
||||
'discount_amount' => 'decimal:2',
|
||||
'payable_amount' => 'decimal:2',
|
||||
'paid_amount' => 'decimal:2',
|
||||
'placed_at' => 'datetime',
|
||||
'paid_at' => 'datetime',
|
||||
'activated_at' => 'datetime',
|
||||
'cancelled_at' => 'datetime',
|
||||
'refunded_at' => 'datetime',
|
||||
'plan_snapshot' => 'array',
|
||||
'meta' => 'array',
|
||||
];
|
||||
|
||||
public function merchant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Merchant::class, 'merchant_id');
|
||||
}
|
||||
|
||||
public function plan(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plan::class);
|
||||
}
|
||||
|
||||
public function siteSubscription(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SiteSubscription::class);
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'created_by_admin_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user