Returns the given model instance.

@param  Model\Mixed $idOrModel

@return Mixed
191116
protected function modelOrFind($idOrModel)
    {
    	if ($idOrModel instanceof Model && $idOrModel->exists()) {
    		return $idOrModel;
    	}

    	return $this->getModel()->findOrFail($idOrModel);
    }
285831
public function getModelInstance()
    {
        if ($this->instance !== null) {
            return $this->instance;
        }
        $model = $this->getModel();
        if ($model === false) {
            return false;
        }
        $instance = new $model();

        return $instance;
    }
1251977
public function makeModel($storeModel = true)
    {
        $model = $this->app->make($this->model());

        if ( ! $model instanceof Model) {
            throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
        }

        if ($storeModel) $this->model = $model;

        return $model;
    }
83789
protected function _getModel()
    {
        if (!$this->_model instanceof KModelInterface)
        {
            if (strpos($this->_model, '.') === false) {
                $this->_model = 'com://admin/'.$this->_package.'.model.'.$this->_model;
            }

            $this->_model = $this->getObject($this->_model);
        }

        return $this->_model;
    }
827133
public function get(AbstractModel $model)
    {
        if (! $this->repo->isModel($model)) {
            throw new InvalidArgumentException(
                sprintf('Model must be %s, was %s', $this->repo->getModelClass(), get_class($model))
            );
        }

        if ($this->map->contains($model)) {
            return $this->map[$model];
        } else {
            return $this->map[$model] = new Links($model);
        }
    }
588884
public function getModel()
    {
        // Use explicilty set model
        if ($this->model) {
            return $this->model;
        }

        // Get the model instance that was passed to Former by the Base Controller
        $model = app('former.populator')->all();

        // Make sure it's a model instance
        if (is_a($model, 'Illuminate\Database\Eloquent\Model')) {
            return $model;
        }
    }
1000403
public function getModel($model)
    {
        if ($model instanceof Model) {
            return $model;
        }

        if (is_string($model) && class_exists($model)) {
            return $this->getModel(new $model());
        }

        throw new InvalidArgumentException("$model is not a valid model");
    }
356092
public function getModel()
    {
        $namePath = $this->getModelClass();
        $model = new $namePath();

        if (!($model instanceof EntityDataModel)) {
            throw new \Exception($this->valueClass.' is not an instance of EntityModel.');
        }

        return $model;
    }
917982
protected function getDefaultFor(Model $model)
    {
        if (! $this->withDefault) {
            return;
        }

        $instance = $this->related->newInstance();

        $foreignKey = $this->getForeignKeyName();

        if (is_array($foreignKey)) { //Check for multi-columns relationship
            foreach ($foreignKey as $index => $key) {
                $instance->setAttribute($key, $model->getAttribute($this->localKey[$index]));
            }
        } else {
            $instance->setAttribute($foreignKey, $model->getAttribute($this->localKey));
        }

        if (is_callable($this->withDefault)) {
            return call_user_func($this->withDefault, $instance) ?: $instance;
        }

        if (is_array($this->withDefault)) {
            $instance->forceFill($this->withDefault);
        }

        return $instance;
    }
792012
public function getIdentifierMade($model)
    {
        if (!is_object($model)) {
            throw new \InvalidArgumentException(sprintf('You must give a object, "%s" given.', gettype($model)));
        }

        $methodMadeBy = 'get' . ucfirst($this->definition->getMadeBy());
        if (!method_exists($model, $methodMadeBy)) {
            throw new \RuntimeException(sprintf('Model "%s" must have method "%s".', get_class($model), $methodMadeBy));
        }

        $modelMade = $model->$methodMadeBy();
        if (!is_object($modelMade)) {
            throw new \RuntimeException(sprintf('Model "%s::%s()" must already return object, "%s" given.', get_class($model), $methodMadeBy, gettype($modelMade)));
        }

        $methodMadeField = 'get' . ucfirst($this->definition->getMadeField());
        if (!method_exists($model->{'get'.$this->definition->getMadeBy()}(), $modelMade)) {
            throw new \RuntimeException(sprintf('Model "%s" must have method "%s".', get_class($modelMade), $methodMadeField));
        }

        return $model->{'get'.ucfirst($this->definition->getMadeBy())}()->{'get'.ucfirst($this->definition->getMadeField())}();
    }
324946
protected function getModel($model) {
		$args = func_get_args();
		array_shift($args);
		require 'app/models/' . $model . '.php';
       	$class = 'Tadpole\model\\' . $model;
		if(!empty($args)) {
			$modData = new ReflectionClass($class);
			$returnMod = $modData->newInstanceArgs($args);
			return $returnMod;
		} else {
        	$returnMod = new $class;
			return $returnMod;
		}
	}
29886
public function getModel()
    {
        if (!isset($this->_pk))
            throw new InvalidCallException('Invalid usage. You must call this method only if load method succeeds');

        if (isset($this->_model))
            return $this->_model;

        $class = $this->modelClass;
        return $this->_model = $class::findOne($this->_pk);
    }
1112396
protected function instanceAndClass($model)
    {

        // Checks without instantiating first
        if (!is_subclass_of($model, Model::class)) {
            throw new UnsupportedParameterException('ModelTypeFactory only supports Eloquent models not '.Type::of($model) );
        }

        return is_object($model) ? [$model, get_class($model)] : [new $model(), $model];
    }
1149859
public static function getInstance(Model $model, array $conf = []) {
        if (null === self::$instance) {
            self::$instance = new RedisCachedModelManager();
        }
        self::$instance->model = $model;
        self::$instance->conf = [
            'redisId'  => 'redis',
            'duration' => [
                'pool'  => 3600,
                'many'  => 300,
                'one'   => 300,
                'count' => 300,
            ],
        ];
        Toolkit::override(self::$instance->conf, $conf);
        return self::$instance;
    }
1152142
protected function getModelIdentity(PhalconModel $model)
    {
        if (property_exists($model, 'id')) {
            return $model->id;
        }

        if (!$this->di->has('modelsMetadata')) {
            return null;
        }

        $primaryKeys = $this->di->get('modelsMetadata')->getPrimaryKeyAttributes($model);

        switch (count($primaryKeys)) {
            case 0:
                return null;
            case 1:
                return $model->{$primaryKeys[0]};
            default:
                return array_intersect_key(get_object_vars($model), array_flip($primaryKeys));
        }
    }
445416
protected function getValueFromModel($model)
    {
        if ( ! ($model instanceof Model)) {
            return null;
        }

        return get_class($model)
             . static::CLASS_AND_KEY_SEPARATOR
             . $model->getKey();
    }
619494
public static function getInstance($identifier = self::PRIMARY)
    {
        $serviceClassName = get_called_class();


        return self::findOrCreateInstance($serviceClassName, $identifier);
    }