Browse Source

Allow filter patterns to supply a name and callback as an easier alternative.

Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
Jason Lewis 12 years ago
parent
commit
ac810f8597
1 changed files with 9 additions and 0 deletions
  1. 9 0
      laravel/routing/route.php

+ 9 - 0
laravel/routing/route.php

@@ -213,6 +213,15 @@ class Route {
 		{
 			if (Str::is($pattern, $this->uri))
 			{
+				// If the filter provided is an array then we need to register
+				// the filter before we can assign it to the route.
+				if (is_array($filter))
+				{
+					list($filter, $callback) = array_values($filter);
+
+					Filter::register($filter, $callback);
+				}
+
 				$filters[] = $filter;
 			}
 		}