From caeb0227b6f83e684e6881057213863ec3513103 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 7 Feb 2014 09:51:09 +0100 Subject: [PATCH] Check if the class is a model before instantiating --- src/Barryvdh/LaravelIdeHelper/ModelsCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index d40ccb6..f5d367a 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -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();