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.
101 lines
3.0 KiB
PHP
101 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\ProcesoAdmision;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Http\Request;
|
|
|
|
class WebController extends Controller
|
|
{
|
|
public function GetProcesoAdmision()
|
|
{
|
|
$procesos = ProcesoAdmision::select(
|
|
'id',
|
|
'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',
|
|
'created_at',
|
|
'updated_at'
|
|
)
|
|
->with([
|
|
'detalles' => function ($query) {
|
|
$query->select(
|
|
'id',
|
|
'proceso_admision_id',
|
|
'tipo',
|
|
'titulo_detalle',
|
|
'descripcion',
|
|
'listas',
|
|
'meta',
|
|
'url',
|
|
'imagen_path',
|
|
'imagen_path_2',
|
|
'created_at',
|
|
'updated_at'
|
|
);
|
|
}
|
|
])
|
|
->latest()
|
|
->get();
|
|
|
|
return response()->json([
|
|
'success' => true,
|
|
'data' => $procesos
|
|
]);
|
|
}
|
|
|
|
|
|
public function obtenerProcesosDisponiblesPreinscripcion(Request $request)
|
|
{
|
|
$now = Carbon::now();
|
|
$postulante = $request->user();
|
|
$procesos = ProcesoAdmision::query()
|
|
->select([
|
|
'id',
|
|
'titulo',
|
|
'slug',
|
|
'link_preinscripcion',
|
|
'fecha_inicio_preinscripcion',
|
|
'fecha_fin_preinscripcion',
|
|
])
|
|
->where('publicado', 1)
|
|
->whereIn('estado', ['publicado', 'en_proceso'])
|
|
->whereNotNull('link_preinscripcion')
|
|
->whereNotNull('fecha_inicio_preinscripcion')
|
|
->whereNotNull('fecha_fin_preinscripcion')
|
|
->where('fecha_inicio_preinscripcion', '<=', $now)
|
|
->where('fecha_fin_preinscripcion', '>=', $now)
|
|
->orderByDesc('fecha_inicio_preinscripcion')
|
|
->orderBy('titulo')
|
|
->get();
|
|
|
|
return response()->json([
|
|
'success' => true,
|
|
'data' => $procesos
|
|
]);
|
|
}
|
|
}
|