<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SpoilerBox extends Model
{
    protected $fillable = ['episode_id', 'user_id', 'body', 'is_spoiler', 'spoiler_score', 'likes'];

    protected $casts = [
        'is_spoiler' => 'boolean',
    ];

    public function episode() { return $this->belongsTo(Episode::class); }
    public function user()    { return $this->belongsTo(User::class); }
    public function boxLikes(){ return $this->hasMany(SpoilerBoxLike::class, 'box_id'); }
}
