LoginSignup
6
6

More than 5 years have passed since last update.

laravel3:Routing の小技(1)

Last updated at Posted at 2013-04-10

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

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'),
));
6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6