From a63c4296a21e60d718fbf2b3b82c5771cb77c87a Mon Sep 17 00:00:00 2001 From: Ruslan Bekenev Date: Thu, 26 Oct 2023 11:30:45 +1100 Subject: [PATCH 1/2] Make `config` variable available only in infyom view files --- src/InfyOmGeneratorServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/InfyOmGeneratorServiceProvider.php b/src/InfyOmGeneratorServiceProvider.php index d2649e974..8de0df709 100755 --- a/src/InfyOmGeneratorServiceProvider.php +++ b/src/InfyOmGeneratorServiceProvider.php @@ -62,7 +62,7 @@ public function boot() $this->registerCommands(); $this->loadViewsFrom(__DIR__.'/../views', 'laravel-generator'); - View::composer('*', function ($view) { + View::composer('laravel-generator::*', function ($view) { $view->with(['config' => app(GeneratorConfig::class)]); }); From 554ad5cf0ab97599d008dd171b4d42585cad770d Mon Sep 17 00:00:00 2001 From: Ruslan Bekenev Date: Wed, 21 Feb 2024 09:14:44 +1100 Subject: [PATCH 2/2] Scope config variable for laravel-generator and adminlte-templates --- src/InfyOmGeneratorServiceProvider.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/InfyOmGeneratorServiceProvider.php b/src/InfyOmGeneratorServiceProvider.php index 8de0df709..9df1fed03 100755 --- a/src/InfyOmGeneratorServiceProvider.php +++ b/src/InfyOmGeneratorServiceProvider.php @@ -62,9 +62,11 @@ public function boot() $this->registerCommands(); $this->loadViewsFrom(__DIR__.'/../views', 'laravel-generator'); - View::composer('laravel-generator::*', function ($view) { - $view->with(['config' => app(GeneratorConfig::class)]); - }); + foreach (['laravel-generator', 'adminlte-templates'] as $packageName) { + View::composer($packageName.'::*', function ($view) { + $view->with(['config' => app(GeneratorConfig::class)]); + }); + } Blade::directive('tab', function () { return '';