I have a project in laravel and there are many routes in that project.
But i just discovered that the routes are all case sensitive, means /advertiser/reports is different than /advertiser/Reports .
So what i want is both the routes should redirect to same view. Currently /advertiser/Reports gives RouteNotFound Exception.
I have read about the Route::pattern() way of doing it but since there are many routes i'll have to put in a lot of efforts for that. So, what i want is a better way of doing it, if there is any.
I wrote a gist which does this: https://gist.github.com/samthomson/f670f9735d200773e543
Edit your app/filters.php to check for uppercase characters in the route and redirect them to a converted route.
In order to make routes case-insensitive you'll need to modify the way routes are matched with the URLs. In Laravel, it all happens in UriValidator object so you'll need to create your own validator.
Luckily, like most tasks in Laravel, it's not really complicated.
First, create the new validator class - the only difference between this one and the original is that you'll append the i modifier at the end of regular expression for the compiled route to switch enable case-insensitive matching.
Secondly, you need to update the list of matchers that are used to match URL to a route and replace the original UriValidator with yours.
In order to do that, add the following at the top of your routes.php file:
This will remove the original validator and add yours to the list of validators.
Keep in mind that this code has not been tested by running. Let me know if there are any typos or something doesn't work as expected. I'll be more than happy to get that working for you :)