public function constrainQuery(EloquentBuilder &$query, $relatedModel, $constraint)
	{
		//if the column hasn't been joined yet, join it
		if (!$this->validator->isJoined($query, $this->getOption('table')))
		{
			$query->join($this->getOption('table'), $relatedModel->getTable().'.'.$relatedModel->getKeyName(), '=', $this->getOption('column2'));
		}

		$query->where($this->getOption('table').'.'.$this->getOption('column'), '=', $constraint);
	}
public function constrainQuery(EloquentBuilder &$query, $relatedModel, $constraint)
	{
		//if the column hasn't been joined yet, join it
		if (!$this->validator->isJoined($query, $this->getOption('table')))
		{
			$query->join($this->getOption('table'), $relatedModel->getTable().'.'.$relatedModel->getKeyName(), '=', $this->getOption('column2'));
		}

		$query->where($this->getOption('table').'.'.$this->getOption('column'), '=', $constraint);
	}
public function constrainQuery ( EloquentBuilder & $ query , $ relatedModel , $ constraint ) { //if the column hasn't been joined yet, join it if ( ! $ this -> validator -> isJoined ( $ query , $ this -> getOption ( 'table' ) ) ) { $ query -> join ( $ this -> getOption ( 'table' ) , $ relatedModel -> getTable ( ) . '.' . $ relatedModel -> getKeyName ( ) , '=' , $ this -> getOption ( 'column2' ) ) ; } $ query -> where ( $ this -> getOption ( 'table' ) . '.' . $ this -> getOption ( 'column' ) , '=' , $ constraint ) ; }
Constrains a query by a given set of constraints

@param  \Illuminate\Database\Eloquent\Builder	$query
@param  \Illuminate\Database\Eloquent\Model 		$relatedModel
@param  string 									$constraint

@return void
Constrains a query by a given set of constraints