public function filterQuery(QueryBuilder &$query, &$selects = null)
    {
        //run the parent method
        parent::filterQuery($query, $selects);

        //get the values
        $value   = $this->getOption('value');
        $table   = $this->getOption('table');
        $column  = $this->getOption('column');
        $column2 = $this->getOption('column2');

        //if there is no value, return
        if (!$value) {
            return;
        }

        $model = $this->config->getDataModel();

        //if the table hasn't been joined yet, join it
        if (!$this->validator->isJoined($query, $table)) {
            $query->join($table, $model->getTable().'.'.$model->getKeyName(), '=', $column);
        }

        //add where clause
        $query->whereIn($column2, $value);

        //add having clauses
        $query->havingRaw('COUNT(DISTINCT '.$query->getConnection()->getTablePrefix().$column2.') = '.count($value));

        //add select field
        if ($selects && !in_array($column2, $selects)) {
            $selects[] = $column2;
        }
    }
public function filterQuery(QueryBuilder &$query, &$selects = null)
    {
        //run the parent method
        parent::filterQuery($query, $selects);

        //get the values
        $value   = $this->getOption('value');
        $table   = $this->getOption('table');
        $column  = $this->getOption('column');
        $column2 = $this->getOption('column2');

        //if there is no value, return
        if (!$value) {
            return;
        }

        $model = $this->config->getDataModel();

        //if the table hasn't been joined yet, join it
        if (!$this->validator->isJoined($query, $table)) {
            $query->join($table, $model->getTable().'.'.$model->getKeyName(), '=', $column);
        }

        //add where clause
        $query->whereIn($column2, $value);

        //add having clauses
        $query->havingRaw('COUNT(DISTINCT '.$query->getConnection()->getTablePrefix().$column2.') = '.count($value));

        //add select field
        if ($selects && !in_array($column2, $selects)) {
            $selects[] = $column2;
        }
    }
public function filterQuery ( QueryBuilder & $ query , & $ selects = null ) { //run the parent method parent :: filterQuery ( $ query , $ selects ) ; //get the values $ value = $ this -> getOption ( 'value' ) ; $ table = $ this -> getOption ( 'table' ) ; $ column = $ this -> getOption ( 'column' ) ; $ column2 = $ this -> getOption ( 'column2' ) ; //if there is no value, return if ( ! $ value ) { return ; } $ model = $ this -> config -> getDataModel ( ) ; //if the table hasn't been joined yet, join it if ( ! $ this -> validator -> isJoined ( $ query , $ table ) ) { $ query -> join ( $ table , $ model -> getTable ( ) . '.' . $ model -> getKeyName ( ) , '=' , $ column ) ; } //add where clause $ query -> whereIn ( $ column2 , $ value ) ; //add having clauses $ query -> havingRaw ( 'COUNT(DISTINCT ' . $ query -> getConnection ( ) -> getTablePrefix ( ) . $ column2 . ') = ' . count ( $ value ) ) ; //add select field if ( $ selects && ! in_array ( $ column2 , $ selects ) ) { $ selects [ ] = $ column2 ; } }
Filters a query object with this item's data.

@param \Illuminate\Database\Query\Builder $query
@param array                              $selects
Filters a query object with this item s data .