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.
40 lines
665 B
PHTML
40 lines
665 B
PHTML
|
2 months ago
|
<?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');
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// Curso → Preguntas
|
||
|
|
public function preguntas()
|
||
|
|
{
|
||
|
|
return $this->hasMany(Pregunta::class);
|
||
|
|
}
|
||
|
|
}
|