Skip to content

Commit 70af876

Browse files
committed
Organize and align routes
1 parent c2407a1 commit 70af876

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

user_guide_src/source/incoming/restful.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ name::
3333
$routes->resource('photos');
3434

3535
// Equivalent to the following:
36-
$routes->get('photos', 'Photos::index');
3736
$routes->get('photos/new', 'Photos::new');
38-
$routes->get('photos/(:segment)/edit', 'Photos::edit/$1');
39-
$routes->get('photos/(:segment)', 'Photos::show/$1');
4037
$routes->post('photos', 'Photos::create');
41-
$routes->delete('photos/(:segment)', 'Photos::delete/$1');
42-
$routes->patch('photos/(:segment)', 'Photos::update/$1');
38+
$routes->get('photos', 'Photos::index');
39+
$routes->get('photos/(:segment)', 'Photos::show/$1');
40+
$routes->get('photos/(:segment)/edit', 'Photos::edit/$1');
4341
$routes->put('photos/(:segment)', 'Photos::update/$1');
42+
$routes->patch('photos/(:segment)', 'Photos::update/$1');
43+
$routes->delete('photos/(:segment)', 'Photos::delete/$1');
4444

4545
.. important:: The routes are matched in the order they are specified, so if you have a resource photos above a get 'photos/poll' the show action's route for the resource line will be matched before the get line. To fix this, move the get line above the resource line so that it is matched first.
4646

@@ -138,17 +138,17 @@ Its usage is similar to the resosurce routing::
138138
$routes->presenter('photos');
139139

140140
// Equivalent to the following:
141-
$routes->get('photos', 'Photos::index');
142-
$routes->post('photos', 'Photos::create'); // alias
143-
$routes->get('photos/show/(:segment)', 'Photos::show/$1');
144-
$routes->get('photos/new', 'Photos::new');
145-
$routes->post('photos/create', 'Photos::create');
146-
$routes->get('photos/edit/(:segment)', 'Photos::edit/$1');
147-
$routes->post('photos/update/(:segment)', 'Photos::update/$1');
148-
$routes->get('photos/remove/(:segment)', 'Photos::remove/$1');
149-
$routes->post('photos/delete/(:segment)', 'Photos::update/$1');
150-
$routes->get('photos/(:segment)', 'Photos::show/$1'); // alias
151-
141+
$routes->get('photos/new', 'Photos::new');
142+
$routes->post('photos/create', 'Photos::create');
143+
$routes->post('photos', 'Photos::create'); // alias
144+
$routes->get('photos', 'Photos::index');
145+
$routes->get('photos/show/(:segment)', 'Photos::show/$1');
146+
$routes->get('photos/(:segment)', 'Photos::show/$1'); // alias
147+
$routes->get('photos/edit/(:segment)', 'Photos::edit/$1');
148+
$routes->post('photos/update/(:segment)', 'Photos::update/$1');
149+
$routes->get('photos/remove/(:segment)', 'Photos::remove/$1');
150+
$routes->post('photos/delete/(:segment)', 'Photos::update/$1');
151+
152152
You would not have routes for `photos` for both a resource and a presenter
153153
controller. You need to distinguish them, for instance::
154154

0 commit comments

Comments
 (0)