routes - Laravel 4 Wildcard Routing to Different Controllers -


realizing i'm going take beating this, have several questions "best practices" when constructing laravel route.

  1. do laravel routes run "first come first serve" top bottom? if route found, pass control controller (or perform action) , terminate?

  2. i have part of application acts url shortner. so, route looks this:

     route::get('/{id}', array('as' => 'home.text', 'uses' => 'homecontroller@text'), function($id){         //make sure id exists before pushing controller.         if (storage::where('shortcode','=', $id)->count() > 0)         {             // route found         }       }); 

how can improved? one, i'm not sure how pass processing on controller conditionally.. sort of controller::make() ..?

3) there better way in laravel check if record exists versus doing

  mode::where('column','=','value')->count() 

4) have legacy urls http://url.com/?p=6&id=wujbl .. can route designed matches ?p={number}&id={id} ? there better way process this?

thanks!

for url shortener can use catch route , if there url redirect otherwise can check query strings.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -