Optional parameter for Laravel routing
I want to make a route for these two urls:
http://localhost/myweb/public/compare
http://localhost/myweb/public/compare/fb
Here is the route I wrote:
Route::get('compare/{fb?}', 'compareController@index');
It doesn't work as expected. Because it also works for this:
http://localhost/myweb/public/compare/anythingElse
Although I want to dedicate it to just these two urls. How can i do this?
+3
source to share