Check if alias is valid

This commit is contained in:
Barry vd. Heuvel
2024-12-29 12:03:42 +01:00
parent 97e3b5eaa0
commit 0fa0403e57
+5 -5
View File
@@ -96,19 +96,19 @@ class Generator
$facade = Model::class;
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : [];
$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)
if (array_key_exists($name, $this->extra)) {
$alias->addClass($this->extra[$name]);
}
$eloquentAliases['__root'] = [$alias];
}
$app = app();
return $this->view->make('helper')
->with('namespaces_by_extends_ns', [])
->with('namespaces_by_alias_ns', $eloquentAliases)
->with('namespaces_by_alias_ns', ['__root' => [$alias]])
->with('real_time_facades', [])
->with('helpers', '')
->with('version', $app->version())