|
3 | 3 | namespace Dingo\Api\Routing; |
4 | 4 |
|
5 | 5 | use Closure; |
6 | | -use Exception; |
7 | | -use RuntimeException; |
| 6 | +use Dingo\Api\Contract\Debug\ExceptionHandler; |
| 7 | +use Dingo\Api\Contract\Routing\Adapter; |
| 8 | +use Dingo\Api\Http\InternalRequest; |
8 | 9 | use Dingo\Api\Http\Request; |
9 | | -use Illuminate\Support\Arr; |
10 | | -use Illuminate\Support\Str; |
11 | 10 | use Dingo\Api\Http\Response; |
12 | | -use Illuminate\Http\JsonResponse; |
13 | | -use Dingo\Api\Http\InternalRequest; |
| 11 | +use Exception; |
14 | 12 | use Illuminate\Container\Container; |
15 | | -use Dingo\Api\Contract\Routing\Adapter; |
16 | | -use Dingo\Api\Contract\Debug\ExceptionHandler; |
17 | | -use Illuminate\Routing\Route as IlluminateRoute; |
| 13 | +use Illuminate\Http\JsonResponse; |
18 | 14 | use Illuminate\Http\Response as IlluminateResponse; |
19 | | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 15 | +use Illuminate\Support\Arr; |
| 16 | +use Illuminate\Support\Str; |
| 17 | +use RuntimeException; |
20 | 18 | use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; |
21 | 19 |
|
22 | 20 | class Router |
@@ -624,17 +622,6 @@ public function getCurrentRoute() |
624 | 622 | return; |
625 | 623 | } |
626 | 624 |
|
627 | | - // We need to recompile the route, adding the where clause (for pattern restrictions) and check again |
628 | | - if (is_object($route) && $route instanceof IlluminateRoute) { |
629 | | - $route->compiled = false; |
630 | | - $this->addWhereClausesToRoute($route); |
631 | | - |
632 | | - // If the matching fails, it would be due to a parameter format validation check fail |
633 | | - if (! $route->matches($this->container['request'])) { |
634 | | - throw new NotFoundHttpException('Not Found!'); |
635 | | - } |
636 | | - } |
637 | | - |
638 | 625 | return $this->currentRoute = $this->createRoute($route); |
639 | 626 | } |
640 | 627 |
|
@@ -857,22 +844,4 @@ public function currentRouteUses($action) |
857 | 844 | { |
858 | 845 | return $this->currentRouteAction() == $action; |
859 | 846 | } |
860 | | - |
861 | | - /** |
862 | | - * Add the necessary where clauses to the route based on its initial registration. |
863 | | - * |
864 | | - * @param \Illuminate\Routing\Route $route |
865 | | - * |
866 | | - * @return \Illuminate\Routing\Route |
867 | | - */ |
868 | | - protected function addWhereClausesToRoute($route) |
869 | | - { |
870 | | - $patterns = app()->make(\Illuminate\Routing\Router::class)->getPatterns(); |
871 | | - |
872 | | - $route->where(array_merge( |
873 | | - $patterns, $route->getAction()['where'] ?? [] |
874 | | - )); |
875 | | - |
876 | | - return $route; |
877 | | - } |
878 | 847 | } |
0 commit comments