From 2ac803d7a7f7d140acf55df199bfec4ee66e1337 Mon Sep 17 00:00:00 2001 From: Muslip Laptop bw015 Date: Thu, 7 Nov 2024 20:46:56 +0700 Subject: [PATCH] Fix #31 --- src/Vite.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Vite.php b/src/Vite.php index 2b4a035..29143b4 100644 --- a/src/Vite.php +++ b/src/Vite.php @@ -110,18 +110,20 @@ public static function isReady(): bool return $result; } - /** - * Check whether the current route is exluded or not. - * - * @return bool - */ - public static function routeIsNotExluded(): bool - { - $routes = explode(',', env('VITE_EXCLUDED_ROUTES')); - - # remove spaces before and after the route. - // foreach($routes as $i => $route) $routes[$i] = ltrim( rtrim($route) ); - - return !in_array(uri_string(), $routes); - } + /** + * Check whether the current route is exluded or not. + * + * @return bool + */ + public static function routeIsNotExluded(): bool + { + $routes = explode(',', env('VITE_EXCLUDED_ROUTES')); + + # remove spaces before and after the route. + // foreach($routes as $i => $route) $routes[$i] = ltrim( rtrim($route) ); + + $routes = array_filter($routes, function ($route) { return $route !== ""; }); + + return !in_array(uri_string(), $routes); + } } \ No newline at end of file