Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

102 řádky
4.4KB

  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. // SOLICITUDES
  49. $routes->get('solicitudes/', 'Admin::solicitudes', ['as' => 'admin_solicitudes']);
  50. $routes->post('solicitud/rechazar/(:segment)', 'Admin::rechazarSolicitud/$1', ['as' => 'admin_solicitud_rechazar']);
  51. $routes->get('solicitud/aprobar/(:segment)', 'Admin::aprobarSolicitud/$1', ['as' => 'admin_solicitud_aprobar']);
  52. $routes->get('solicitud/(:segment)', 'Admin::revisarSolicitud/$1', ['as' => 'admin_solicitud_revisar']);
  53. // ENCUESTAS
  54. $routes->get('encuestas/', 'Admin::encuestas', ['as' => 'admin_encuestas']);
  55. $routes->match(['get', 'post'], 'encuesta/nueva', 'Admin::nuevaEncuesta', ['as' => 'admin_encuesta_nueva']);
  56. $routes->get('encuesta/(:segment)', 'Admin::encuesta/$1', ['as' => 'admin_encuesta']);
  57. $routes->match(['get', 'post'], 'encuesta/editar/(:segment)', 'Admin::editarEncuesta/$1', ['as' => 'admin_encuesta_editar']);
  58. $routes->get('encuesta/eliminar/(:segment)', 'Admin::eliminarEncuesta/$1', ['as' => 'admin_encuesta_eliminar']);
  59. // PREGUNTAS
  60. $routes->match(['get', 'post'], 'encuesta/(:segment)/pregunta/', 'Admin::nuevaPregunta/$1', ['as' => 'admin_pregunta_nueva']);
  61. $routes->match(['get', 'post'], 'pregunta/editar/(:segment)', 'Admin::editarPregunta/$1', ['as' => 'admin_pregunta_editar']);
  62. $routes->post('pregunta_post', 'Admin::preguntaPost', ['as' => 'pregunta_post']);
  63. $routes->get('pregunta/eliminar/(:segment)', 'Admin::eliminarPregunta/$1', ['as' => 'admin_pregunta_eliminar']);
  64. // GRUPOS
  65. $routes->get('create_group/', 'Admin::createGroup');
  66. });
  67. /*
  68. * --------------------------------------------------------------------
  69. * Additional Routing
  70. * --------------------------------------------------------------------
  71. *
  72. * There will often be times that you need additional routing and you
  73. * need it to be able to override any defaults in this file. Environment
  74. * based routes is one such time. require() additional route files here
  75. * to make that happen.
  76. *
  77. * You will have access to the $routes object within that file without
  78. * needing to reload it.
  79. */
  80. if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
  81. require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
  82. }