mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Check if alias is valid
This commit is contained in:
+5
-5
@@ -96,19 +96,19 @@ class Generator
|
|||||||
$facade = Model::class;
|
$facade = Model::class;
|
||||||
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : [];
|
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : [];
|
||||||
$alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces);
|
$alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces);
|
||||||
if ($alias->isValid()) {
|
if (!$alias->isValid()) {
|
||||||
|
throw new \RuntimeException('Cannot generate Eloquent helper');
|
||||||
|
}
|
||||||
|
|
||||||
//Add extra methods, from other classes (magic static calls)
|
//Add extra methods, from other classes (magic static calls)
|
||||||
if (array_key_exists($name, $this->extra)) {
|
if (array_key_exists($name, $this->extra)) {
|
||||||
$alias->addClass($this->extra[$name]);
|
$alias->addClass($this->extra[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$eloquentAliases['__root'] = [$alias];
|
|
||||||
}
|
|
||||||
|
|
||||||
$app = app();
|
$app = app();
|
||||||
return $this->view->make('helper')
|
return $this->view->make('helper')
|
||||||
->with('namespaces_by_extends_ns', [])
|
->with('namespaces_by_extends_ns', [])
|
||||||
->with('namespaces_by_alias_ns', $eloquentAliases)
|
->with('namespaces_by_alias_ns', ['__root' => [$alias]])
|
||||||
->with('real_time_facades', [])
|
->with('real_time_facades', [])
|
||||||
->with('helpers', '')
|
->with('helpers', '')
|
||||||
->with('version', $app->version())
|
->with('version', $app->version())
|
||||||
|
|||||||
Reference in New Issue
Block a user