From a0d33497a4b2583105c987fa81db0ac933772056 Mon Sep 17 00:00:00 2001 From: iLyas Farawe Date: Thu, 12 Mar 2026 17:33:43 +0100 Subject: [PATCH 1/2] fix: change container binding to use scoped instead of bind for octane compatibility --- src/LogViewerServiceProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LogViewerServiceProvider.php b/src/LogViewerServiceProvider.php index 40eca267..6af655cc 100644 --- a/src/LogViewerServiceProvider.php +++ b/src/LogViewerServiceProvider.php @@ -32,13 +32,13 @@ public function register() { $this->mergeConfigFrom(self::basePath("/config/{$this->name}.php"), $this->name); - $this->app->bind('log-viewer', LogViewerService::class); - $this->app->bind('log-viewer-cache', function () { + $this->app->scoped('log-viewer', LogViewerService::class); + $this->app->scoped('log-viewer-cache', function () { return Cache::driver(config('log-viewer.cache_driver')); }); if (! $this->app->bound(LogTypeRegistrar::class)) { - $this->app->singleton(LogTypeRegistrar::class, function () { + $this->app->scoped(LogTypeRegistrar::class, function () { return new LogTypeRegistrar; }); } From 90391a1a781ca9e94d23b385315b959ca6ca5013 Mon Sep 17 00:00:00 2001 From: Arunas Skirius Date: Sun, 15 Mar 2026 21:26:57 +0200 Subject: [PATCH 2/2] Fall back to singleton when scoped is unavailable (Laravel <8.47) --- src/LogViewerServiceProvider.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/LogViewerServiceProvider.php b/src/LogViewerServiceProvider.php index 6af655cc..20827996 100644 --- a/src/LogViewerServiceProvider.php +++ b/src/LogViewerServiceProvider.php @@ -32,13 +32,15 @@ public function register() { $this->mergeConfigFrom(self::basePath("/config/{$this->name}.php"), $this->name); - $this->app->scoped('log-viewer', LogViewerService::class); - $this->app->scoped('log-viewer-cache', function () { + $bindMethod = method_exists($this->app, 'scoped') ? 'scoped' : 'singleton'; + + $this->app->$bindMethod('log-viewer', LogViewerService::class); + $this->app->$bindMethod('log-viewer-cache', function () { return Cache::driver(config('log-viewer.cache_driver')); }); if (! $this->app->bound(LogTypeRegistrar::class)) { - $this->app->scoped(LogTypeRegistrar::class, function () { + $this->app->$bindMethod(LogTypeRegistrar::class, function () { return new LogTypeRegistrar; }); }