<?php

namespace App\Models;

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

class Discipline extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'enabled',
        'code',
        'sport'
    ];

    public function scopeOfSport($query, $sport)
    {
        return $query->where('sport', $sport);
    }

    public function getFullNameAttribute()
    {
        return "{$this->sport} - {$this->name} ({$this->code})";
    }

    public function canDelete()
    {
        return true;
    }

}
