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
PHP
77 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Examen extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'examenes';
|
|
|
|
protected $fillable = [
|
|
'postulante_id',
|
|
'area_proceso_id',
|
|
'pagado',
|
|
'tipo_pago',
|
|
'pago_id',
|
|
'intentos',
|
|
'hora_inicio',
|
|
'estado',
|
|
'hora_fin',
|
|
];
|
|
|
|
protected $casts = [
|
|
'pagado' => 'boolean',
|
|
'hora_inicio' => 'datetime',
|
|
'hora_fin' => 'datetime',
|
|
];
|
|
|
|
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,
|
|
'id',
|
|
'id',
|
|
'area_proceso_id',
|
|
'area_id'
|
|
);
|
|
}
|
|
|
|
public function proceso()
|
|
{
|
|
return $this->areaProceso->proceso;
|
|
}
|
|
|
|
public function preguntasAsignadas()
|
|
{
|
|
return $this->hasMany(PreguntaAsignada::class, 'examen_id');
|
|
}
|
|
|
|
}
|