src/SearchableTrait.php
protected function makeGroupBy(Builder $query)
    {
        if ($groupBy = $this->getGroupBy()) {
            $query->groupBy($groupBy);
        } else {
            $driver = $this->getDatabaseDriver();

            if ($driver == 'sqlsrv') {
                $columns = $this->getTableColumns();
            } else {
                $columns = $this->getTable() . '.' .$this->primaryKey;
            }

            $query->groupBy($columns);

            $joins = array_keys(($this->getJoins()));

            foreach ($this->getColumns() as $column => $relevance) {
                array_map(function ($join) use ($column, $query) {
                    if (Str::contains($column, $join)) {
                        $query->groupBy($column);
                    }
                }, $joins);
            }
        }
    }
protected function makeGroupBy(Builder $query)
    {
        if ($groupBy = $this->getGroupBy()) {
            $query->groupBy($groupBy);
        } else {
            $driver = $this->getDatabaseDriver();

            if ($driver == 'sqlsrv') {
                $columns = $this->getTableColumns();
            } else {
                $columns = $this->getTable() . '.' .$this->primaryKey;
            }

            $query->groupBy($columns);

            $joins = array_keys(($this->getJoins()));

            foreach ($this->getColumns() as $column => $relevance) {
                array_map(function ($join) use ($column, $query) {
                    if (Str::contains($column, $join)) {
                        $query->groupBy($column);
                    }
                }, $joins);
            }
        }
    }
protected function makeGroupBy ( Builder $ query ) { if ( $ groupBy = $ this -> getGroupBy ( ) ) { $ query -> groupBy ( $ groupBy ) ; } else { $ driver = $ this -> getDatabaseDriver ( ) ; if ( $ driver == 'sqlsrv' ) { $ columns = $ this -> getTableColumns ( ) ; } else { $ columns = $ this -> getTable ( ) . '.' . $ this -> primaryKey ; } $ query -> groupBy ( $ columns ) ; $ joins = array_keys ( ( $ this -> getJoins ( ) ) ) ; foreach ( $ this -> getColumns ( ) as $ column => $ relevance ) { array_map ( function ( $ join ) use ( $ column , $ query ) { if ( Str :: contains ( $ column , $ join ) ) { $ query -> groupBy ( $ column ) ; } } , $ joins ) ; } } }
Makes the query not repeat the results.

@param \Illuminate\Database\Eloquent\Builder $query
Makes the query not repeat the results .