chore: init saasshop repo + sql migrations runner + gitee go
This commit is contained in:
44
app/Models/SiteSubscription.php
Normal file
44
app/Models/SiteSubscription.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class SiteSubscription extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'merchant_id', 'plan_id', 'status', 'source', 'subscription_no', 'plan_name', 'billing_cycle', 'period_months',
|
||||
'amount', 'starts_at', 'ends_at', 'trial_ends_at', 'activated_at', 'cancelled_at', 'snapshot', 'meta',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'amount' => 'decimal:2',
|
||||
'starts_at' => 'datetime',
|
||||
'ends_at' => 'datetime',
|
||||
'trial_ends_at' => 'datetime',
|
||||
'activated_at' => 'datetime',
|
||||
'cancelled_at' => 'datetime',
|
||||
'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 platformOrders(): HasMany
|
||||
{
|
||||
return $this->hasMany(PlatformOrder::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user