I have a problem with Laravel 5, and to be precise, I can't find the solution for it. In C# (ASP.NET MVC) it's easy to solve. For example, I have these routes (I'll just type the route content, and the function header, for the sake of simplicity)
/{category}/Page{page}
/Page{page}
/{category}
The function is defined inside Product controller. function header looks like this:
public function list($page = 1, $category = null)
the problem is, whenever I enter just one argument, it doesn't send the value for the parameter by the name I set in the route, but rather, it pushes values by function parameter order. So, when I open /Page1, it works properly, value of 1 is sent to $page variable, but when I access /Golf(made up on the spot), it also sends the value to the $page variable. Any possible idea how to avoid this, or do I really need to make different functions to handle these cases?
In C#, it properly sends the value, and keeps the default value for undefined parameter.
Hope you have an answer for me. Thank you in advance and have a nice day :)