34 lines
661 B
PHP
34 lines
661 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class UserVip extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['user_id', 'vip_id', 'name', 'price', 'times', 'gift', 'status', 'success_time'];
|
|
|
|
protected $casts = [
|
|
'times' => 'json',
|
|
'gift' => 'json'
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function vip()
|
|
{
|
|
return $this->belongsTo(Vip::class, 'vip_id');
|
|
}
|
|
|
|
public function pay()
|
|
{
|
|
return $this->morphOne(PayLog::class, 'payable');
|
|
}
|
|
}
|