<?php

namespace App\Models;

use App\Scopes\UserScope;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\UserCollect
 *
 * @property int $id
 * @property int $user_id user_id
 * @property int $episode_id 短剧ID
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect newQuery()
 * @method static \Illuminate\Database\Query\Builder|UserCollect onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect query()
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereEpisodeId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect whereUserId($value)
 * @method static \Illuminate\Database\Query\Builder|UserCollect withTrashed()
 * @method static \Illuminate\Database\Query\Builder|UserCollect withoutTrashed()
 * @mixin \Eloquent
 * @property-read \App\Models\Episode|null $episode
 * @method static \Illuminate\Database\Eloquent\Builder|UserCollect filterUser()
 * @property-read \App\Models\UserWatchRecord|null $watchRecord
 */
class UserCollect extends Model
{
    use HasFactory,SoftDeletes,UserScope;

    protected $table = 'user_collect';

    public function episode()
    {
        return $this->belongsTo(Episode::class,'episode_id','id');
    }

    public function watchRecord()
    {
        return $this->belongsTo(UserWatchRecord::class,'episode_id','episode_id');
    }
}
