<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class VideoView extends Model
{
    use HasFactory;

    protected $table = 'video_views';

    protected $fillable = [
        'user_id',
        'video_id',
        'earned_amount',
        'watched_at',
    ];

    // relation: ek view ek video se belong karta hai
    public function video()
    {
        return $this->belongsTo(Video::class, 'video_id');
    }

    // relation: ek view ek user se belong karta hai
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
