Created
March 26, 2021 08:44
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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