mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Check if the class is a model before instantiating
This commit is contained in:
@@ -146,6 +146,9 @@ class ModelsCommand extends Command {
|
||||
$reflectionClass = new \ReflectionClass($name);
|
||||
if (!$reflectionClass->IsInstantiable()) {
|
||||
throw new \Exception($name . ' is not instanciable.');
|
||||
}elseif(!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')){
|
||||
$this->comment("Class '$name' is not a model");
|
||||
continue;
|
||||
}
|
||||
|
||||
$model = new $name();
|
||||
|
||||
Reference in New Issue
Block a user