public function test_singular_resources_can_be_nested() { $_SERVER['REQUEST_METHOD'] = 'GET'; Pigeon::map(function ($r) { $r->resource('profile', function ($r) { $r->get('rescan', 'profile#rescan'); }); }); $this->assertEquals(array('profile' => 'profile/show', 'profile/new' => 'profile/create_new', 'profile/edit' => 'profile/edit', 'profile/rescan' => 'profile/rescan'), Pigeon::draw()); }
| */ Pigeon::map(function ($r) { $r->get('default_controller', '/pages/view/fr/home'); $r->get('^(' . CULTURES . ')$', '/pages/view/fr/home'); /*========== admin ==========*/ $r->get('admin', 'admin/view/home'); $r->get('admin/view_loader/(:any)/(:any)/(:any)/(:any)', 'admin/view_loader/$1/$2/$3/$4'); /*========== News ==========*/ $r->get('^' . CULTURES . '/news/*([a-zA-Z0-9\\-}]*)$', 'news/news_list/$1'); $r->get('^' . CULTURES . '/news/post/([0-9]+\\-\\S+)$', 'news/view/$1'); /*========== portfolio ==========*/ $r->get('^(' . CULTURES . ')/portfolio/([0-9]*\\-\\S*)$', 'portfolio/view/$1/$2'); // sans catégorie $r->get('^(' . CULTURES . ')/portfolio/c([0-9]+\\-\\S+)/([0-9]*\\-\\S*)$', 'portfolio/view/$1/$3/$2'); // avec catégories $r->get('^(' . CULTURES . ')/portfolio$', 'portfolio/porfolio_list/$1'); $r->get('^(' . CULTURES . ')/portfolio/c([0-9]+\\-\\S+)$', 'portfolio/porfolio_list/$1/$2'); /*========== Accounts ==========*/ $r->get('^' . CULTURES . '/accounts/register', array('Accounts', 'Register')); $r->post('^' . CULTURES . '/accounts/register-profile', array('Accounts', 'RegisterProfile')); $r->post('^' . CULTURES . '/accounts/create', array('Accounts', 'create')); /*========== contacts ==========*/ $r->post('^(' . CULTURES . ')/contact/send/(:any)', 'contact/send/$2'); /*========== sitemap ==========*/ $r->get('sitemap\\.xml', "sitemap/sitemap_view"); /*========== pages ==========*/ $r->get('^(' . CULTURES . ')/(:any)', 'pages/view/$1/$2'); }); $route = Pigeon::draw(); // URI like '/en/about' -> use controller 'about'
| | $route['default_controller'] = 'welcome'; | | This route indicates which controller class should be loaded if the | URI contains no data. In the above example, the "welcome" class | would be loaded. | | $route['404_override'] = 'errors/page_missing'; | | This route will tell the Router what URI segments to use if those provided | in the URL cannot be matched to a valid route. | */ $route['default_controller'] = "home"; $route['404_override'] = ''; Pigeon::map(function ($r) { $r->get('test', 'map/getAll'); // contact section $r->get('contacts', 'api/contacts/index'); $r->get('contacts/(:num)', 'api/contacts/getById/$1'); $r->post('contacts/(:num)', 'api/contacts/index/$1'); $r->put('contacts/(:num)', 'api/contacts/index/$1'); $r->delete('contacts/(:num)', 'api/contacts/index/$1'); $r->get('contacts/(:num)/invoices', 'api/contacts/getAllInvoicesByContactId/$1'); $r->get('contacts/(:num)/bills', 'api/contacts/getAllBillsByContactId/$1'); $r->get('contacts/(:num)/activities', 'api/contacts/getAllActivitiesByContactId/$1'); $r->get('contacts/types', 'api/contacts/types'); }); // $route = Pigeon::draw(); /* End of file routes.php */ /* Location: ./application/config/routes.php */