Skip to content

Instantly share code, notes, and snippets.

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 yavgel85/8a933adef78630de43ad3b065cc0df8e to your computer and use it in GitHub Desktop.
Save yavgel85/8a933adef78630de43ad3b065cc0df8e to your computer and use it in GitHub Desktop.
When registering routes, you may limit the possible values for a route parameter #laravel #route
<?php
// When registering routes, you may limit the possible values for a route parameter. In this way you may change your response based on a valid parameter, having an expressive route and not a Query string parameter.
Route::get('stores/{store}/orders/{type?}')
->uses('StoreOrderController@byType')
->name('stores.orders.by-type.index')
->where('type', 'new|fulfilling|pickup|history')
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment