You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
4.5KB

  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Commands\Utilities\Routes;
  4. // Create a new instance of our RouteCollection class.
  5. $routes = Services::routes();
  6. // Load the system's routing file first, so that the app and ENVIRONMENT
  7. // can override as needed.
  8. if (is_file(SYSTEMPATH . 'Config/Routes.php')) {
  9. require SYSTEMPATH . 'Config/Routes.php';
  10. }
  11. /*
  12. * --------------------------------------------------------------------
  13. * Router Setup
  14. * --------------------------------------------------------------------
  15. */
  16. $routes->setDefaultNamespace('App\Controllers');
  17. $routes->setDefaultController('Home');
  18. $routes->setDefaultMethod('index');
  19. $routes->setTranslateURIDashes(false);
  20. $routes->set404Override();
  21. // The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
  22. // where controller filters or CSRF protection are bypassed.
  23. // If you don't want to define all routes, please use the Auto Routing (Improved).
  24. // Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
  25. //$routes->setAutoRoute(false);
  26. /*
  27. * --------------------------------------------------------------------
  28. * Route Definitions
  29. * --------------------------------------------------------------------
  30. */
  31. // We get a performance increase by specifying the default
  32. // route since we don't have to scan directories.
  33. $routes->get('/', 'Prestador::index', ['as' => 'home']);
  34. $routes->get('horas/', 'Prestador::horas');
  35. $routes->match(['get', 'post'], 'registro/', 'Prestador::formulario');
  36. $routes->get('success', 'Prestador::success');
  37. // ENCUESTAS
  38. $routes->get('encuesta/answered', 'Encuesta::userAnswered');
  39. $routes->get('encuesta/(:segment)', 'Encuesta::encuesta/$1', ['as' => 'encuesta']);
  40. $routes->post('encuesta/submit/(:segment)', 'Encuesta::submit/$1', ['as' => 'encuesta_submit']);
  41. // utilizar método attemptRegister personalizdo (no requiere de username)
  42. $routes->post('register/', 'Auth::attemptRegister');
  43. // ADMIN AUTH
  44. $routes->match(['get', 'post'], 'admin/login/', 'AdminAuth::login', ['as' => 'admin_login']);
  45. $routes->get('admin/logout', 'AdminAuth::logout', ['as' => 'admin_logout']);
  46. $routes->group('admin', ['filter' => 'admin_filter'], static function ($routes) {
  47. $routes->get('/', 'Admin::home', ['as' => 'admin_home']);
  48. // PRESTADORES
  49. $routes->get('prestadores/', 'Admin::prestadores', ['as' => 'admin_prestadores']);
  50. // SOLICITUDES
  51. $routes->get('solicitudes/', 'Admin::solicitudes', ['as' => 'admin_solicitudes']);
  52. $routes->post('solicitud/rechazar/(:segment)', 'Admin::rechazarSolicitud/$1', ['as' => 'admin_solicitud_rechazar']);
  53. $routes->get('solicitud/aprobar/(:segment)', 'Admin::aprobarSolicitud/$1', ['as' => 'admin_solicitud_aprobar']);
  54. $routes->get('solicitud/(:segment)', 'Admin::revisarSolicitud/$1', ['as' => 'admin_solicitud_revisar']);
  55. // ENCUESTAS
  56. $routes->get('encuestas/', 'Admin::encuestas', ['as' => 'admin_encuestas']);
  57. $routes->match(['get', 'post'], 'encuesta/nueva', 'Admin::nuevaEncuesta', ['as' => 'admin_encuesta_nueva']);
  58. $routes->get('encuesta/(:segment)', 'Admin::encuesta/$1', ['as' => 'admin_encuesta']);
  59. $routes->match(['get', 'post'], 'encuesta/editar/(:segment)', 'Admin::editarEncuesta/$1', ['as' => 'admin_encuesta_editar']);
  60. $routes->get('encuesta/eliminar/(:segment)', 'Admin::eliminarEncuesta/$1', ['as' => 'admin_encuesta_eliminar']);
  61. // PREGUNTAS
  62. $routes->match(['get', 'post'], 'encuesta/(:segment)/pregunta/', 'Admin::nuevaPregunta/$1', ['as' => 'admin_pregunta_nueva']);
  63. $routes->match(['get', 'post'], 'pregunta/editar/(:segment)', 'Admin::editarPregunta/$1', ['as' => 'admin_pregunta_editar']);
  64. $routes->post('pregunta_post', 'Admin::preguntaPost', ['as' => 'pregunta_post']);
  65. $routes->get('pregunta/eliminar/(:segment)', 'Admin::eliminarPregunta/$1', ['as' => 'admin_pregunta_eliminar']);
  66. // GRUPOS
  67. $routes->get('create_group/', 'Admin::createGroup');
  68. });
  69. /*
  70. * --------------------------------------------------------------------
  71. * Additional Routing
  72. * --------------------------------------------------------------------
  73. *
  74. * There will often be times that you need additional routing and you
  75. * need it to be able to override any defaults in this file. Environment
  76. * based routes is one such time. require() additional route files here
  77. * to make that happen.
  78. *
  79. * You will have access to the $routes object within that file without
  80. * needing to reload it.
  81. */
  82. if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
  83. require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
  84. }