Illuminate\Routing\Router::addWhereClausesToRoute PHP Method

addWhereClausesToRoute() protected method

Add the necessary where clauses to the route based on its initial registration.
protected addWhereClausesToRoute ( Illuminate\Routing\Route $route ) : Illuminate\Routing\Route
$route Illuminate\Routing\Route
return Illuminate\Routing\Route
    protected function addWhereClausesToRoute($route)
    {
        $where = isset($route->getAction()['where']) ? $route->getAction()['where'] : [];
        $route->where(array_merge($this->patterns, $where));
        return $route;
    }

Usage Example

Example #1
0
 /**
  * Add the necessary where clauses to the route based on its initial registration.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @return \Illuminate\Routing\Route
  */
 protected function addWhereClausesToRoute($route)
 {
     foreach ($this->get_patterns_defaults() as $key => $value) {
         $route->defaults($key, $value);
     }
     if ($route->getName() == 'page') {
         #dd($route);
     }
     parent::addWhereClausesToRoute($route);
 }