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.
70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class ProcesoAdmision extends Model
|
|
{
|
|
protected $table = 'procesos_admision';
|
|
|
|
protected $fillable = [
|
|
'titulo','subtitulo','descripcion','slug',
|
|
'tipo_proceso','modalidad',
|
|
'publicado','fecha_publicacion',
|
|
'fecha_inicio_preinscripcion','fecha_fin_preinscripcion',
|
|
'fecha_inicio_inscripcion','fecha_fin_inscripcion',
|
|
'fecha_examen1','fecha_examen2',
|
|
'fecha_resultados',
|
|
'fecha_inicio_biometrico','fecha_fin_biometrico',
|
|
'imagen_path','banner_path','brochure_path',
|
|
'link_preinscripcion','link_inscripcion','link_resultados','link_reglamento',
|
|
'estado',
|
|
];
|
|
|
|
protected $casts = [
|
|
'publicado' => 'boolean',
|
|
'fecha_publicacion' => 'datetime',
|
|
'fecha_inicio_preinscripcion' => 'datetime',
|
|
'fecha_fin_preinscripcion' => 'datetime',
|
|
'fecha_inicio_inscripcion' => 'datetime',
|
|
'fecha_fin_inscripcion' => 'datetime',
|
|
'fecha_examen1' => 'datetime',
|
|
'fecha_examen2' => 'datetime',
|
|
'fecha_resultados' => 'datetime',
|
|
'fecha_inicio_biometrico' => 'datetime',
|
|
'fecha_fin_biometrico' => 'datetime',
|
|
];
|
|
|
|
protected $appends = ['imagen_url','banner_url','brochure_url'];
|
|
|
|
public function detalles(): HasMany
|
|
{
|
|
return $this->hasMany(ProcesoAdmisionDetalle::class, 'proceso_admision_id');
|
|
}
|
|
|
|
public function getImagenUrlAttribute(): ?string
|
|
{
|
|
return $this->imagen_path ? Storage::disk('public')->url($this->imagen_path) : null;
|
|
}
|
|
|
|
public function getBannerUrlAttribute(): ?string
|
|
{
|
|
return $this->banner_path ? Storage::disk('public')->url($this->banner_path) : null;
|
|
}
|
|
|
|
public function getBrochureUrlAttribute(): ?string
|
|
{
|
|
return $this->brochure_path ? Storage::disk('public')->url($this->brochure_path) : null;
|
|
}
|
|
|
|
|
|
public function resultados()
|
|
{
|
|
return $this->hasMany(ResultadoAdmision::class, 'idproceso');
|
|
}
|
|
}
|
|
|