mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 14:16:57 -04:00
39 lines
890 B
PHP
39 lines
890 B
PHP
<?php
|
|
|
|
namespace Modules\Subscription\Entities;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PaymentCode extends Model
|
|
{
|
|
use SoftDeletes;
|
|
protected $table = 'payment_codes';
|
|
protected $guarded = ['id'];
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
|
public static function boot()
|
|
{
|
|
parent::boot();
|
|
static::creating(function ($model) {
|
|
$model->code = (string) Str::uuid();
|
|
});
|
|
}
|
|
|
|
public function user() {
|
|
return $this->belongsTo(User::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function planPrice() {
|
|
return $this->belongsTo(SubscriptionPlanPrice::class, 'subscription_plan_price_id', 'id');
|
|
}
|
|
|
|
public function addons()
|
|
{
|
|
return $this->hasMany(PaymentCodeAddon::class, 'payment_code_id');
|
|
}
|
|
}
|