/** * Add necessary where restrictions * * @param string $pattern * @param array $options * @return void */ private function addWhere($pattern, $options) { if ($options['check'] !== false) { preg_match_all('#\\{(\\w+)\\}#', $pattern, $matches); foreach ($matches[0] as $key => $value) { $this->route = $this->route->where(str_replace(array('{', '}'), '', $value), $this->whereRegex($options['check'])); } } }
/** * Determine if the current route uses a given controller action. * * @param string $action * @return bool */ public function currentRouteUses($action) { return $this->currentRoute->getOption('_uses') === $action; }
public function get($key, $default = null) { return $this->currentroute->getParameter($key, $default); }
/** * Build the parameter list for short circuit parameters. * * @param Illuminate\Routing\Route $route * @param array $params * @return array */ protected function buildParameterList($route, array $params) { $keys = $route->getParameterKeys(); // If the number of keys is less than the number of parameters on a route // we'll fill out the parameter arrays with empty bindings on the rest // of the spots until they are equal so we can run an array combine. if (count($params) < count($keys)) { $difference = count($keys) - count($params); $params += array_fill(count($params), $difference, null); } return array_combine($keys, $params); }
/** * Call the given route filter. * * @param Illuminate\Routing\Route $route * @param string $filter * @param Symfony\Component\HttpFoundation\Request $request * @param array $parameters * @return mixed */ protected function callFilter($route, $filter, $request, $parameters = array()) { if (isset($this->callbackFilters[$filter])) { $callback = $this->callbackFilters[$filter]; return call_user_func_array($callback, $parameters); } return $route->callFilter($filter, $request, $parameters); }