From 1353c67516eaab071f9b6a8c989777b90956f70b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sun, 29 Dec 2024 19:19:01 +0100 Subject: [PATCH] Fix view instance --- src/Console/MetaCommand.php | 7 ++++++- src/Generator.php | 4 ++-- src/IdeHelperServiceProvider.php | 22 ---------------------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/Console/MetaCommand.php b/src/Console/MetaCommand.php index df6f2b0..cc878cd 100644 --- a/src/Console/MetaCommand.php +++ b/src/Console/MetaCommand.php @@ -135,7 +135,7 @@ class MetaCommand extends Command return gettype($value); }); - $content = $this->view->make('meta', [ + $content = $this->view->make('ide-helper::meta', [ 'bindings' => $bindings, 'methods' => $this->methods, 'factories' => $factories, @@ -191,6 +191,8 @@ class MetaCommand extends Command return [ 'configs' => $this->loadTemplate('configs')->pluck('name')->filter(), 'routes' => $this->loadTemplate('routes')->pluck('name')->filter(), + 'views' => $this->loadTemplate('views')->pluck('key')->filter(), + ]; } @@ -215,6 +217,9 @@ class MetaCommand extends Command '\route()' => [ 0 => 'routes', ], + '\view()' => [ + 0 => 'views', + ], ]; } diff --git a/src/Generator.php b/src/Generator.php index f12f4e5..5bbd27e 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -79,7 +79,7 @@ class Generator public function generate() { $app = app(); - return $this->view->make('helper') + return $this->view->make('ide-helper::helper') ->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace()) ->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace()) ->with('real_time_facades', $this->getRealTimeFacades()) @@ -105,7 +105,7 @@ class Generator } $app = app(); - return $this->view->make('helper') + return $this->view->make('ide-helper::helper') ->with('namespaces_by_extends_ns', []) ->with('namespaces_by_alias_ns', ['__root' => [$alias]]) ->with('real_time_facades', []) diff --git a/src/IdeHelperServiceProvider.php b/src/IdeHelperServiceProvider.php index ec55678..143e29b 100644 --- a/src/IdeHelperServiceProvider.php +++ b/src/IdeHelperServiceProvider.php @@ -65,12 +65,6 @@ class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProv $configPath = __DIR__ . '/../config/ide-helper.php'; $this->mergeConfigFrom($configPath, 'ide-helper'); - $this->app->when([GeneratorCommand::class, MetaCommand::class, ModelsCommand::class]) - ->needs(\Illuminate\Contracts\View\Factory::class) - ->give(function () { - return $this->createLocalViewFactory(); - }); - $this->commands( [ GeneratorCommand::class, @@ -95,20 +89,4 @@ class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProv EloquentCommand::class, ]; } - - /** - * @return Factory - */ - private function createLocalViewFactory() - { - $resolver = new EngineResolver(); - $resolver->register('php', function () { - return new PhpEngine($this->app['files']); - }); - $finder = new FileViewFinder($this->app['files'], [__DIR__ . '/../resources/views']); - $factory = new Factory($resolver, $finder, $this->app['events']); - $factory->addExtension('php', 'php'); - - return $factory; - } }