diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index 6063758..eacc336 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -141,7 +141,12 @@ class ModelsCommand extends Command { $this->properties = array(); $this->methods = array(); if(class_exists($name)){ - try{ + // handle abstract classes, interfaces, ... + $reflectionClass = new \ReflectionClass($name); + if (!$reflectionClass->IsInstantiable()) { + throw new \Exception($name . ' is not instanciable.'); + } + $model = new $name(); $this->getPropertiesFromTable($model); $this->getPropertiesFromMethods($model);