Skip to content

Commit

Permalink
middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
schpill committed Feb 11, 2017
1 parent 6ed0484 commit 347b6a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function makeResourceWithName($name, array $array = [])

self::$resources[$name] = $resource;

return $this;
return $resource;
}

public static function makeFromResourceName($name, $default = [], $unserialize = true)
Expand Down
10 changes: 7 additions & 3 deletions lib/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,17 @@ public static function __callStatic($m, $a)
return $route->setName($name);
});

$route->macro('middleware', function (callable $cb) use ($route) {
return $route->setMiddleware($cb);
});

$route->macro('uses', function ($string) use ($route) {
if (fnmatch('*@*', $string)) {
list($controller, $action) = explode('@', $string, 2);
}

if (fnmatch('*#*', $string)) {
} elseif (fnmatch('*#*', $string)) {
list($controller, $action) = explode('#', $string, 2);
} elseif (fnmatch('*.*', $string)) {
list($controller, $action) = explode('.', $string, 2);
}

return $route
Expand Down

0 comments on commit 347b6a4

Please sign in to comment.