Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.