<?php

namespace App\Models;

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

class Curso extends Model
{
    use HasFactory;

    protected $table = 'cursos';

    protected $fillable = [
        'nombre',
        'codigo',
        'activo',
    ];

    protected $casts = [
        'activo' => 'boolean',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];



    public function areas()
    {
        return $this->belongsToMany(Area::class, 'area_curso')
                    ->withTimestamps();
    }



    public function preguntas()
    {
        return $this->hasMany(Pregunta::class);
    }
}
