Check if the class is a model before instantiating

This commit is contained in:
Barry vd. Heuvel
2014-02-07 09:51:09 +01:00
parent 948eb369a6
commit caeb0227b6
@@ -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();