mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 05:16:49 -04:00
66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Modules\Subscription\Entities;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Modules\Product\Entities\Product;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class SubscriptionPlan extends Model
|
|
{
|
|
use SoftDeletes;
|
|
protected $dates = ['deleted_at'];
|
|
|
|
protected $table = 'subscription_plans';
|
|
protected $guarded = ['id'];
|
|
protected $fillable = [
|
|
'title',
|
|
'description',
|
|
'image',
|
|
'commission',
|
|
'discount',
|
|
'staff_referral_bonus',
|
|
'customer_referral_bonus',
|
|
'status',
|
|
'prepaid',
|
|
'order',
|
|
'credits',
|
|
'stripe_product_id',
|
|
'paypal_product_id'
|
|
];
|
|
|
|
protected $casts = [
|
|
'commission' => 'integer',
|
|
'staff_referral_bonus' => 'integer',
|
|
'customer_referral_bonus' => 'integer',
|
|
'discount' => 'float',
|
|
'prepaid' => 'boolean',
|
|
'status' => 'boolean'
|
|
];
|
|
|
|
protected $appends = [
|
|
'image_url'
|
|
];
|
|
|
|
|
|
public function prices()
|
|
{
|
|
return $this->hasMany(SubscriptionPlanPrice::class, 'subscription_plan_id');
|
|
}
|
|
|
|
public function getCreditsAttribute($value)
|
|
{
|
|
return json_decode($value, true);
|
|
}
|
|
|
|
// public function setCreditsAttribute($value)
|
|
// {
|
|
// $this->attributes['credits'] = json_encode($value);
|
|
// }
|
|
|
|
public function getImageUrlAttribute()
|
|
{
|
|
return "/public/storage/{$this->image}";
|
|
}
|
|
}
|