You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
703 B
PHP
41 lines
703 B
PHP
<?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();
|
|
}
|
|
|
|
|
|
// Curso → Preguntas
|
|
public function preguntas()
|
|
{
|
|
return $this->hasMany(Pregunta::class);
|
|
}
|
|
}
|