Commit dfe3a046 authored by Taylor Otwell's avatar Taylor Otwell

added support for route filter parameters.

parent 21592ec6
......@@ -134,7 +134,7 @@ class Caller {
// an underscore are not publicly available.
if (is_null($controller) or ($method == 'before' or strncmp($method, '_', 1) === 0))
{
return $this->container->resolve('laravel.response')->error('404');
return Response::error('404');
}
$controller->container = $this->container;
......@@ -222,6 +222,16 @@ class Caller {
{
foreach ((array) $filters as $filter)
{
// Parameters may be passed into routes by specifying the list of parameters after
// a colon. If parameters are present, we will merge them into the parameter array
// that was passed to the method and slice the parameters off of the filter string.
if (($colon = strpos($filter, ':')) !== false)
{
$parameters = array_merge($parameters, explode(',', substr($filter, $colon + 1)));
$filter = substr($filter, 0, $colon);
}
if ( ! isset($this->filters[$filter])) continue;
$response = call_user_func_array($this->filters[$filter], $parameters);
......
......@@ -126,7 +126,9 @@ class Route {
{
if (is_array($this->callback) and isset($this->callback[$name]))
{
return explode(', ', $this->callback[$name]);
$filters = $this->callback[$name];
return (is_string($filters)) ? explode('|', $filters) : $filters;
}
return array();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment