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