Skip to content

Instantly share code, notes, and snippets.

@dalabarge
Created June 25, 2014 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalabarge/d2d46f2388d4b4f8302a to your computer and use it in GitHub Desktop.
Save dalabarge/d2d46f2388d4b4f8302a to your computer and use it in GitHub Desktop.
Route Binding Best Pratcies

Route Bindings

// One-line description of route
Route::get('url', [
    'as'     => 'domain.name',
    'before' => [ 'filter' ],
    'uses'   => '\Controller@name' ]);
  • The route url and opening bindings array bracket [ on the same line
  • The binding keys should be on their own lines
  • The binding keys should be in alphabetical order
  • The route should be named as <domain>.<name> (e.g: user.login)
  • The controller should be global namespace escaped using the backslash \
  • The closing bindings array bracket ] and closing binding function syntax ); should be on the last line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment