From ab9fad33e795589a788642d1761570bd2c14c89a Mon Sep 17 00:00:00 2001 From: erikn69 Date: Fri, 8 Sep 2023 09:06:17 -0500 Subject: [PATCH] fix blade render with cache clean option --- src/DebugbarViewEngine.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DebugbarViewEngine.php b/src/DebugbarViewEngine.php index d808193a..36588b20 100644 --- a/src/DebugbarViewEngine.php +++ b/src/DebugbarViewEngine.php @@ -35,7 +35,14 @@ public function __construct(Engine $engine, LaravelDebugbar $laravelDebugbar) */ public function get($path, array $data = []) { - $shortPath = ltrim(str_replace(base_path(), '', realpath($path)), '/'); + $basePath = base_path(); + $shortPath = @file_exists((string) $path) ? realpath($path) : $path; + + if (strpos($shortPath, $basePath) === 0) { + $shortPath = substr($shortPath, strlen($basePath)); + } + + $shortPath = ltrim(str_replace('\\', '/', $shortPath), '/'); return $this->laravelDebugbar->measure($shortPath, function () use ($path, $data) { return $this->engine->get($path, $data);