diff --git a/src/PrettyRoutesController.php b/src/PrettyRoutesController.php index 9062300..1820496 100644 --- a/src/PrettyRoutesController.php +++ b/src/PrettyRoutesController.php @@ -1,10 +1,12 @@ -filter(function ($value, $key) use ($regex) { @@ -29,5 +37,4 @@ public function show() 'middlewareClosure' => $middlewareClosure, ]); } - } diff --git a/src/Utils/RouteUtils.php b/src/Utils/RouteUtils.php new file mode 100644 index 0000000..281237c --- /dev/null +++ b/src/Utils/RouteUtils.php @@ -0,0 +1,76 @@ +methods(), config('pretty-routes.hide_methods')) as $method) { + if (str_contains(strtolower($method), $search)) { + array_push($routes, $route); + $next = true; + } + } + if ($next) continue; + + // domain filter + if (strlen($route->domain()) != 0 and str_contains(strtolower($route->domain()), $search)) { + array_push($routes, $route); + continue; + } + + // uri filter + if (str_contains(strtolower($route->uri()), $search)) { + array_push($routes, $route); + continue; + } + + // name filter + if (str_contains(strtolower($route->getName()), $search)) { + array_push($routes, $route); + continue; + } + + // action filter + if (str_contains(strtolower($route->getActionName()), $search)) { + array_push($routes, $route); + continue; + } + + // middleware filter + foreach (array_diff($route->middleware(), config('pretty-routes.hide_methods')) as $middleware) { + if (str_contains(strtolower($middleware), $search)) { + array_push($routes, $route); + $next = true; + } + } + if ($next) continue; + } + + return $routes; + } +} diff --git a/views/routes.blade.php b/views/routes.blade.php index f785ced..a3b8d16 100644 --- a/views/routes.blade.php +++ b/views/routes.blade.php @@ -32,12 +32,28 @@ table.hide-domains .domain { display: none; } + + .float-right { + float: right; + } + + .clear-search { + color:black; + font-weight: bold; + }