src/Matthenning/EloquentApiFilter/EloquentApiFilter.php
private function applyFilter(Builder $query, $field, $filter, $or = false)
    {
        $filter = explode(':', $filter);
        if (count($filter) > 1) {
            $operator = $this->getFilterOperator($filter[0]);
            $value = $this->replaceWildcards($filter[1]);
        }
        else {
            $operator = '=';
            $value = $this->replaceWildcards($filter[0]);
        }

        $fields = explode('.', $field);
        if (count($fields) > 1) {
            return $this->applyNestedFilter($query, $fields, $operator, $value, $or);
        }
        else {
            return $this->applyWhereClause($query, $field, $operator, $value, $or);
        }
    }
private function applyFilter(Builder $query, $field, $filter, $or = false)
    {
        $filter = explode(':', $filter);
        if (count($filter) > 1) {
            $operator = $this->getFilterOperator($filter[0]);
            $value = $this->replaceWildcards($filter[1]);
        }
        else {
            $operator = '=';
            $value = $this->replaceWildcards($filter[0]);
        }

        $fields = explode('.', $field);
        if (count($fields) > 1) {
            return $this->applyNestedFilter($query, $fields, $operator, $value, $or);
        }
        else {
            return $this->applyWhereClause($query, $field, $operator, $value, $or);
        }
    }
private function applyFilter ( Builder $ query , $ field , $ filter , $ or = false ) { $ filter = explode ( ':' , $ filter ) ; if ( count ( $ filter ) > 1 ) { $ operator = $ this -> getFilterOperator ( $ filter [ 0 ] ) ; $ value = $ this -> replaceWildcards ( $ filter [ 1 ] ) ; } else { $ operator = '=' ; $ value = $ this -> replaceWildcards ( $ filter [ 0 ] ) ; } $ fields = explode ( '.' , $ field ) ; if ( count ( $ fields ) > 1 ) { return $ this -> applyNestedFilter ( $ query , $ fields , $ operator , $ value , $ or ) ; } else { return $ this -> applyWhereClause ( $ query , $ field , $ operator , $ value , $ or ) ; } }
Applies a single filter to the query

@param Builder $query
@param $field
@param $filter
@param $or = false
@return Builder
Applies a single filter to the query