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.

Routes.php 4.6KB

2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
2 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. $routes->get('respuestas/', 'Admin::respuestas', ['as' => 'admin_respuestas']);
  62. // PREGUNTAS
  63. $routes->match(['get', 'post'], 'encuesta/(:segment)/pregunta/', 'Admin::nuevaPregunta/$1', ['as' => 'admin_pregunta_nueva']);
  64. $routes->match(['get', 'post'], 'pregunta/editar/(:segment)', 'Admin::editarPregunta/$1', ['as' => 'admin_pregunta_editar']);
  65. $routes->post('pregunta_post', 'Admin::preguntaPost', ['as' => 'pregunta_post']);
  66. $routes->get('pregunta/eliminar/(:segment)', 'Admin::eliminarPregunta/$1', ['as' => 'admin_pregunta_eliminar']);
  67. // GRUPOS
  68. $routes->get('create_group/', 'Admin::createGroup');
  69. });
  70. /*
  71. * --------------------------------------------------------------------
  72. * Additional Routing
  73. * --------------------------------------------------------------------
  74. *
  75. * There will often be times that you need additional routing and you
  76. * need it to be able to override any defaults in this file. Environment
  77. * based routes is one such time. require() additional route files here
  78. * to make that happen.
  79. *
  80. * You will have access to the $routes object within that file without
  81. * needing to reload it.
  82. */
  83. if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
  84. require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
  85. }