xinningsu /
laravel-route-trailing-slash
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Sulao\LRTS\Routing; |
||
| 4 | |||
| 5 | class Router extends \Illuminate\Routing\Router |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * What to do when current route mismatched because of trailing slash, |
||
| 9 | * null: do nothing. |
||
| 10 | * 404: abort 404, not found exception will be threw. |
||
| 11 | * 301/302: redirect to the url with trailing slash. |
||
| 12 | * |
||
| 13 | * @var null|int |
||
| 14 | */ |
||
| 15 | public static $mismatchAction = null; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Add a route to the underlying route collection. |
||
| 19 | * |
||
| 20 | * @param array|string $methods |
||
| 21 | * @param string $uri |
||
| 22 | * @param array|string|callable|null $action |
||
| 23 | * @return \Illuminate\Routing\Route |
||
| 24 | */ |
||
| 25 | public function addRoute($methods, $uri, $action) |
||
| 26 | { |
||
| 27 | $route = parent::addRoute($methods, $uri, $action); |
||
| 28 | $route->originalUri = $uri; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 29 | |||
| 30 | return $route; |
||
| 31 | } |
||
| 32 | } |
||
| 33 |