Saturday, 15 January 2011

php - Best practice in pointing multiple urls to same method in Laravel 4 -


Is there a better way to do this in Laravel 4 without repeating this code?

  Route: Receive ('site / {url}', 'search controller @ index'); Route: get ('test1 / {url}', 'search controller @ index'); Route: get ('test2 / {url}', 'search controller @ index');  

i.e. What is the best practice to achieve this by pointing to multiple URLs in a single method with query string values?

Thank you in advance for your suggestions.

Make a passage with a dynamic one and limit one set of values ​​with the first segment and regex :

  Root :: find ('{first} / {url}', 'SearchController @ index') - & gt; Where ('first', '(site | test1 | test2)');  

No comments:

Post a Comment