diff --git a/composer.json b/composer.json index e754ae6..5cc5083 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": ">=5.5.0", "illuminate/support": "~5.1", - "illuminate/routing": "^5.1" + "illuminate/routing": "~5.1" }, "require-dev": { "phpunit/phpunit": "4.*" diff --git a/src/Helper.php b/src/Helper.php new file mode 100644 index 0000000..f29d9f4 --- /dev/null +++ b/src/Helper.php @@ -0,0 +1,23 @@ +getRoutes(); + + foreach ($routes as $route) { + $actions = (array) $route->getAction(); + + if (array_key_exists('middleware', $actions) + && in_array($group, (array) $actions['middleware']) + ) { + return true; + } + } + + return false; + } +}