Fix view instance

This commit is contained in:
Barry vd. Heuvel
2024-12-29 19:19:01 +01:00
parent 6b934aa43a
commit 1353c67516
3 changed files with 8 additions and 25 deletions
+6 -1
View File
@@ -135,7 +135,7 @@ class MetaCommand extends Command
return gettype($value); return gettype($value);
}); });
$content = $this->view->make('meta', [ $content = $this->view->make('ide-helper::meta', [
'bindings' => $bindings, 'bindings' => $bindings,
'methods' => $this->methods, 'methods' => $this->methods,
'factories' => $factories, 'factories' => $factories,
@@ -191,6 +191,8 @@ class MetaCommand extends Command
return [ return [
'configs' => $this->loadTemplate('configs')->pluck('name')->filter(), 'configs' => $this->loadTemplate('configs')->pluck('name')->filter(),
'routes' => $this->loadTemplate('routes')->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()' => [ '\route()' => [
0 => 'routes', 0 => 'routes',
], ],
'\view()' => [
0 => 'views',
],
]; ];
} }
+2 -2
View File
@@ -79,7 +79,7 @@ class Generator
public function generate() public function generate()
{ {
$app = app(); $app = app();
return $this->view->make('helper') return $this->view->make('ide-helper::helper')
->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace()) ->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace())
->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace()) ->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace())
->with('real_time_facades', $this->getRealTimeFacades()) ->with('real_time_facades', $this->getRealTimeFacades())
@@ -105,7 +105,7 @@ class Generator
} }
$app = app(); $app = app();
return $this->view->make('helper') return $this->view->make('ide-helper::helper')
->with('namespaces_by_extends_ns', []) ->with('namespaces_by_extends_ns', [])
->with('namespaces_by_alias_ns', ['__root' => [$alias]]) ->with('namespaces_by_alias_ns', ['__root' => [$alias]])
->with('real_time_facades', []) ->with('real_time_facades', [])
-22
View File
@@ -65,12 +65,6 @@ class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProv
$configPath = __DIR__ . '/../config/ide-helper.php'; $configPath = __DIR__ . '/../config/ide-helper.php';
$this->mergeConfigFrom($configPath, 'ide-helper'); $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( $this->commands(
[ [
GeneratorCommand::class, GeneratorCommand::class,
@@ -95,20 +89,4 @@ class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProv
EloquentCommand::class, 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;
}
} }