Edited at

laravel3:Routing の小技(1)

More than 3 years have passed since last update.

たとえば こんな風に書いてたら、


application/routes.php

Route::any( 'product/(:num)/edit', array(

'as' => 'list',
'uses' => 'list@edit',
));
Route::any( 'product/(:num)/show', array(
'as' => 'list',
'uses' => 'list@show',
));

こんな書き方で1行省略できます。


application/routes.php

Route::any( 'product/(:num)/(:any)', array(

'as' => 'list',
'uses' => 'list@(:2)',
'defaults' => array(0,'show'),
));