/** * Determine if a route in the array matches the request. * * @param array $routes * @param \Illuminate\http\Request $request * @param bool $includingMethod * * @return \Illuminate\Routing\Route|null */ protected function check(array $routes, $request, $includingMethod = true) { $foundRoute = parent::check($routes, $request, $includingMethod); // If no route found, check if the 404 route is set, if so, return that route as our found route. if (!$foundRoute && isset($routes['404'])) { $foundRoute = $routes['404']; } return $foundRoute; }
/** * @param Request $request * * @return \Illuminate\Routing\Route|null */ public function getRouteForRequest(Request $request) { $routes = $this->collection->get($request->getMethod()); return $this->collection->check($routes, $request); }