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.

77 lines
1.5 KiB
PHTML

2 months ago
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Examen extends Model
{
use HasFactory;
protected $table = 'examenes';
2 months ago
protected $fillable = [
2 months ago
'postulante_id',
'area_proceso_id',
2 months ago
'pagado',
'tipo_pago',
'pago_id',
2 months ago
'intentos',
'hora_inicio',
2 months ago
'estado',
'hora_fin',
];
protected $casts = [
'pagado' => 'boolean',
'hora_inicio' => 'datetime',
'hora_fin' => 'datetime',
2 months ago
];
public function postulante()
{
return $this->belongsTo(Postulante::class, 'postulante_id');
}
// public function area()
// {
// return $this->belongsTo(Area::class, 'area_id');
// }
public function areaProceso()
{
return $this->belongsTo(AreaProceso::class, 'area_proceso_id');
}
public function pago()
{
return $this->belongsTo(Pago::class, 'pago_id');
}
// Accesos rápidos opcionales
public function area()
{
return $this->hasOneThrough(
Area::class,
AreaProceso::class,
2 months ago
'id',
'id',
'area_proceso_id',
'area_id'
2 months ago
);
}
public function proceso()
{
return $this->areaProceso->proceso;
}
public function preguntasAsignadas()
{
return $this->hasMany(PreguntaAsignada::class, 'examen_id');
}
}