public function instance($model, $altClass = null, $fail = false)
	{
		// get current class/model
		if(is_null($altClass))
			$class = get_class();
		else
			$class = (string) $class;

		// get instance
		if(is_a($model, $class))
			return $model;
		elseif(is_int($model))
			return ($fail) ? $this->findOrFail($model) : $this->find($model);

		return null;
	}
public function instance($model, $altClass = null, $fail = false)
	{
		// get current class/model
		if(is_null($altClass))
			$class = get_class();
		else
			$class = (string) $class;

		// get instance
		if(is_a($model, $class))
			return $model;
		elseif(is_int($model))
			return ($fail) ? $this->findOrFail($model) : $this->find($model);

		return null;
	}
public function instance ( $ model , $ altClass = null , $ fail = false ) { // get current class/model if ( is_null ( $ altClass ) ) $ class = get_class ( ) ; else $ class = ( string ) $ class ; // get instance if ( is_a ( $ model , $ class ) ) return $ model ; elseif ( is_int ( $ model ) ) return ( $ fail ) ? $ this -> findOrFail ( $ model ) : $ this -> find ( $ model ) ; return null ; }
get instance of a model
get instance of a model