November 15, 2021 in Laravel, Tips and Tricks
optional argument in Laravel route
Occasionally you may need to specify a route parameter that may not always be present in the URI. You may do so by placing a ? mark after the parameter name. Make sure to give the route’s corresponding variable a default value: