54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Filters;
|
|
|
|
use App\Models\UserModel;
|
|
use CodeIgniter\Filters\FilterInterface;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
|
|
class InicioFilter implements FilterInterface
|
|
{
|
|
/**
|
|
* Revisar que el usuario ya tenga su registro en la tabla prestador
|
|
* De lo contrario, redireccionar a formualrio
|
|
*
|
|
* @param RequestInterface $request
|
|
* @param array|null $arguments
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function before(RequestInterface $request, $arguments = null)
|
|
{
|
|
// Usuario no cuenta tiene asignado un registro en `prestador`
|
|
if (!user()->idprestador) {
|
|
|
|
// Usuario no ha registrado sus datos por primera vez
|
|
if (!user()->rh_prestador_solicitud_id) {
|
|
return redirect('registro');
|
|
}
|
|
|
|
// Ya registró sus datos, está pendiente la aprobación de RH
|
|
return \Config\Services::response()->setBody(view('Prestador/success'));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Allows After filters to inspect and modify the response
|
|
* object as needed. This method does not allow any way
|
|
* to stop execution of other after filters, short of
|
|
* throwing an Exception or Error.
|
|
*
|
|
* @param RequestInterface $request
|
|
* @param ResponseInterface $response
|
|
* @param array|null $arguments
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
|
{
|
|
//
|
|
}
|
|
}
|