mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 05:16:49 -04:00
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Modules\Subscription\Entities;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Modules\Seller\Entities\SellerProduct;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class CustomerSubscription extends Model
|
|
{
|
|
|
|
use SoftDeletes;
|
|
protected $dates = ['renewal_start_date','trial_end_date','last_payment_date','next_payment_at','expired_at','deleted_at'];
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'approved' => 'boolean',
|
|
'renew_now' => 'boolean',
|
|
'trialing' => 'boolean',
|
|
];
|
|
|
|
public function planPrice() {
|
|
return $this->hasOne(SubscriptionPlanPrice::class, 'id', 'subscription_plan_price_id')->withTrashed();
|
|
}
|
|
|
|
public function paymentCode() {
|
|
return $this->hasOne(PaymentCode::class, 'id', 'payment_code_id')->withTrashed();
|
|
}
|
|
|
|
public function user() {
|
|
return $this->belongsTo(User::class, 'customer_id', 'id');
|
|
}
|
|
|
|
public function discount() {
|
|
return $this->hasOne(SubscriptionCouponRedemption::class, 'subscription_id', 'id')->withTrashed();
|
|
}
|
|
}
|