<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class News extends Model
{
    protected $fillable = [
        'title',
        'summary',
        'image_url',
        'external_url',
        'category',
        'youtube_url',
        'is_published',
        'related_team_id',
    ];

    protected function casts(): array
    {
        return [
            'is_published' => 'boolean',
        ];
    }

    public function relatedTeam(): BelongsTo
    {
        return $this->belongsTo(Team::class, 'related_team_id');
    }
}
