public function getModel($model)
{
if ($model instanceof EloquentModel) {
return $model;
}
if (is_string($model) && class_exists($model)) {
return $this->getModel(new $model());
}
throw new InvalidArgumentException("{$model} is not a valid model");
}