<?php

namespace App\Models;

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

class Tv extends Model
{
    use HasFactory;

    protected $fillable = [
        'title', 
        'tv_category_id', 
        'thumbnail_image', 
        'video_type', 
        'youtube_url', 
        'other_url', 
        'video', 
        'description', 
        'status',
        'total_views'
    ];

    protected function casts(): array
    {
        return [
            'status' => 'integer',
            'total_views' => 'integer',
        ];
    }

    public function category()
    {
        return $this->belongsTo(TvCategory::class, 'tv_category_id');
    }
}
