Init(Core): Change repo
This commit is contained in:
39
app/Models/UserSubscriber.php
Normal file
39
app/Models/UserSubscriber.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserSubscriber extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'subscribe_plan_id',
|
||||
'expired_at',
|
||||
'subscription_id',
|
||||
'purchase_token',
|
||||
'is_free'
|
||||
];
|
||||
|
||||
public function subscribe()
|
||||
{
|
||||
return $this->belongsTo(SubscribePlan::class,'subscribe_plan_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getExpiredDayAttribute()
|
||||
{
|
||||
return $this->expired_at->diffInDays(now());
|
||||
}
|
||||
|
||||
protected $casts = [
|
||||
'expired_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user