diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php index f2d3e9e65..ccad3a67b 100644 --- a/resources/views/layout.blade.php +++ b/resources/views/layout.blade.php @@ -192,6 +192,12 @@
+ @if (! $assetsAreCurrent) +
+ The published Telescope assets are not up-to-date with the installed version. To update, run:
php artisan telescope:publish +
+ @endif +
diff --git a/src/Http/Controllers/HomeController.php b/src/Http/Controllers/HomeController.php index c106e87fc..96dcf425b 100644 --- a/src/Http/Controllers/HomeController.php +++ b/src/Http/Controllers/HomeController.php @@ -17,6 +17,7 @@ public function index() return view('telescope::layout', [ 'cssFile' => Telescope::$useDarkTheme ? 'app-dark.css' : 'app.css', 'telescopeScriptVariables' => Telescope::scriptVariables(), + 'assetsAreCurrent' => Telescope::assetsAreCurrent(), ]); } } diff --git a/src/Telescope.php b/src/Telescope.php index 02926f8fb..cd5317994 100644 --- a/src/Telescope.php +++ b/src/Telescope.php @@ -7,6 +7,7 @@ use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Log\Events\MessageLogged; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\File; use Illuminate\Support\Str; use Laravel\Telescope\Contracts\EntriesRepository; use Laravel\Telescope\Contracts\TerminableRepository; @@ -701,4 +702,21 @@ public static function ignoreMigrations() return new static; } + + /** + * Check if assets are up-to-date. + * + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException + * @return bool + */ + public static function assetsAreCurrent() + { + $publishedPath = public_path('vendor/telescope/mix-manifest.json'); + + if (! File::exists($publishedPath)) { + throw new \RuntimeException('The Telescope assets are not published. Please run: php artisan telescope:publish'); + } + + return File::get($publishedPath) === File::get(__DIR__.'/../public/mix-manifest.json'); + } }