Skip to content

Commit 0fa0403

Browse files
committed
Check if alias is valid
1 parent 97e3b5e commit 0fa0403

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Generator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ public function generateEloquent()
9696
$facade = Model::class;
9797
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : [];
9898
$alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces);
99-
if ($alias->isValid()) {
100-
//Add extra methods, from other classes (magic static calls)
101-
if (array_key_exists($name, $this->extra)) {
102-
$alias->addClass($this->extra[$name]);
103-
}
99+
if (!$alias->isValid()) {
100+
throw new \RuntimeException('Cannot generate Eloquent helper');
101+
}
104102

105-
$eloquentAliases['__root'] = [$alias];
103+
//Add extra methods, from other classes (magic static calls)
104+
if (array_key_exists($name, $this->extra)) {
105+
$alias->addClass($this->extra[$name]);
106106
}
107107

108108
$app = app();
109109
return $this->view->make('helper')
110110
->with('namespaces_by_extends_ns', [])
111-
->with('namespaces_by_alias_ns', $eloquentAliases)
111+
->with('namespaces_by_alias_ns', ['__root' => [$alias]])
112112
->with('real_time_facades', [])
113113
->with('helpers', '')
114114
->with('version', $app->version())

0 commit comments

Comments
 (0)