@param string|array $with

@return static
178936
public function with($with)
    {
        if (is_string($with)) {
            if (strpos($with, ',') === false) {
                $with = [$with];
            } else {
                $with = (array)preg_split('#[\s,]+#', $with, -1, PREG_SPLIT_NO_EMPTY);
            }
        }

        $with = $this->_with ? array_merge($this->_with, $with) : $with;

        foreach ($with as $k => $v) {
            $name = is_string($k) ? $k : $v;
            if (($pos = strpos($name, '.')) === false) {
                continue;
            }
            $parent_name = substr($name, 0, $pos);
            $child_name = substr($name, $pos + 1);
            if (!isset($with[$parent_name])) {
                continue;
            }

            $parent_value = $with[$parent_name];
            if (!$parent_value instanceof QueryInterface) {
                $with[$parent_name] = $this->relationsManager->getQuery($this->_model, $parent_name, $parent_value);
            }

            $with[$parent_name]->with(is_int($k) ? [$child_name] : [$child_name => $v]);
            unset($with[$k]);
        }

        $this->_with = $with;

        return $this;
    }
213978
public function withQuery(array $query = [])
    {
        // Set Query in class.
        $this->query = collect($this->query)->merge($query)->all();

        return $this;
    }
1289285
public function with(...$with): self
    {
        $this->hasWith = true;
        $this->with = $with;

        return $this;
    }
180041
final public function withMethod($method): self
    {
        $request = clone $this;
        $request->method = $this->filterMethod($method);

        return $request;
    }
453958
public function renderViewIf(string $view, array $with = null): string
    {
        if ($this->exists($view)) {
            return $this->render($view, $with);
        } else {
            return '';
        }
    }
262369
protected function initSpec($methodName, array $with)
    {
        return new StaticSpec($this->testCase, $this->className, $methodName, $with, Shmock::$policies);
    }
125150
public static function with( $with, $callback = null ) 
	{	
		if ( !is_array( $with ) )
		{
			$with = array( $with );
		}
		
		$settings = static::_model();
		
		$query = DB::select( $settings['table'] );
		
		// run the callback
		if ( !is_null( $callback ) )
		{
			call_user_func_array( $callback, array( &$query ) );
		}
		
		// alway group the result and fetch assoc
		$query->forward_key( $settings['primary_key'] );
		$query->fetch_arguments = array( 'assoc' );
		
		// get the main result set
		$results = static::assign( $query->run() );
		$singleton = false;
		
		if ( !is_array( $results ) )
		{
			$results = array( $results );
			$singleton = true;
		}
		
		$ref_object = reset( $results );
		
		// we have to sort the relationships to make sure that
		// select the relations in the right order.	
		asort( $with );
		
		foreach( $with as $relation => $callback )
		{
			if ( is_int( $relation ) && is_string( $callback ) )
			{
				$relation = $callback;
				$callback = null;
			}
			
			if ( strpos( $relation, '.' ) !== false )
			{	
				$relation_layers = explode( '.', $relation );
				
				$relation_name = array_pop( $relation_layers );
				
				$relation_collection = array();
				
				foreach( $results as $key => &$item )
				{
					$curr_item = $item;
					
					foreach( $relation_layers as $layer )
					{
						$curr_item = $curr_item->raw( $layer );
					}
					
					$relation_collection[] = $curr_item;
				}
				
				$ref_object = reset( $relation_collection );
				
				$relation_object = call_user_func( array( $ref_object, $relation_name ) );
				if ( $relation_object instanceof Model_Relation )
				{
					$relation_object->collection_assign( $relation_name, $relation_collection, $callback );
				}
			}
			else
			{
				$relation_object = call_user_func( array( $ref_object, $relation ) );
				if ( $relation_object instanceof Model_Relation )
				{
					$relation_object->collection_assign( $relation, $results, $callback );
				}
				
			}
		}
		
		if ( $singleton )
		{
			return reset( $results );
		}
		
		// and assign
		return $results;
	}
297430
public function all(array $with = [], $all = false)
    {
        $query = $this->with($with);

        if (!$all) {
            $query->published();
        }

        // Query ORDER BY
        $query->order();

        // Get
        return $query->get();
    }
191744
public function setWithAccountNumber($withAccountNumber = true)
    {
        $this->isBool($withAccountNumber, 'withAccountNumber');
        $this->withAccountNumber = $withAccountNumber;

        if ($withAccountNumber === false) {
            $this->accountNumber = '';
        }

        return $this;
    }
381168
public function findWith($find, array $with = [], $column = 'id', array $columns = ['*'])
    {
        return $this->whereWith($find, $column, $with)->firstOrFail($columns);
    }
431286
public function orWhere($wheres = array())
		{
			if (count($wheres) > 0) {
				if ( ! isset($this->wheres['$or']) or ! Arrays::is($this->wheres['$or'])) {
					$this->wheres['$or'] = array();
				}

				foreach ($wheres as $wh => $val) {
					$this->wheres['$or'][] = array($wh => $val);
				}
			}

			return $this;
		}
977717
public function with(array $data)
    {
        foreach($data as $method)
        {
            if(method_exists($this, $method))
            {
                $this->$method();
            }
            elseif(taxonomy_exists($method))
            {
                $this->taxonomy($method);
            }
            elseif(function_exists('get_field'))
            {
                $this->field($method);
            }
        }

        return $this;
    }
629547
public function where($conditions): self
    {
        if ($conditions[0] instanceof Closure) {
            $this->addClauseCondClosure('where', 'AND', $conditions[0]);

            return $this;
        }
        $this->where[] = ['and', $conditions];

        return $this;
    }
1252801
public function extract($element, $withKey = null)
    {
        return new static(Utils\CollectionKeyWalker::extract($this, $element, $withKey));
    }
592523
public function find($id, array $with = array())
    {
        $entity = $this->make($with);

        return $entity->findOrFail($id);
    }
1113318
public function where(array $where)
    {
        $this->applyCriteria();
        $this->applyScope();

        $this->applyConditions($where);

        return $this;
    }
272394
function with(array $options, $throwException = false)
    {
        $this->_view->with($options, $throwException);
        return $this;
    }