Laravel case insensitive routes

后端 未结 3 1193
遥遥无期
遥遥无期 2021-01-12 16:28

How do I define a case insensitive (part of a) route?

Example:

  • Route::get(\'/{userId}/profile\');
  • http://domain.com/123/profi
3条回答
  •  难免孤独
    2021-01-12 16:44

    Adding patterns only works on one route at a time, if you want all routes to be case insensitive add this to your /app/filter.php file in the before section:

    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.

提交回复
热议问题