public function applySearch(Builder $query, \Illuminate\Http\Request $request)
    {
        $search = $request->input('search.value');
        if (empty($search)) {
            return;
        }

        $query->where(function (Builder $query) use ($search) {
            $columns = $this->getColumns()->all();

            foreach ($columns as $column) {
                if ($column->isSearchable()) {
                    if ($column instanceof ColumnInterface) {
                        if (($metaInstance = $column->getMetaData()) instanceof ColumnMetaInterface) {
                            if (method_exists($metaInstance, 'onSearch')) {
                                $metaInstance->onSearch($column, $query, $search);
                                continue;
                            }
                        }

                        if (is_callable($callback = $column->getSearchCallback())) {
                            $callback($column, $query, $search);
                            continue;
                        }
                    }

                    $query->orWhere($column->getName(), 'like', '%'.$search.'%');
                }
            }
        });
    }
public function applySearch(Builder $query, \Illuminate\Http\Request $request)
    {
        $search = $request->input('search.value');
        if (empty($search)) {
            return;
        }

        $query->where(function (Builder $query) use ($search) {
            $columns = $this->getColumns()->all();

            foreach ($columns as $column) {
                if ($column->isSearchable()) {
                    if ($column instanceof ColumnInterface) {
                        if (($metaInstance = $column->getMetaData()) instanceof ColumnMetaInterface) {
                            if (method_exists($metaInstance, 'onSearch')) {
                                $metaInstance->onSearch($column, $query, $search);
                                continue;
                            }
                        }

                        if (is_callable($callback = $column->getSearchCallback())) {
                            $callback($column, $query, $search);
                            continue;
                        }
                    }

                    $query->orWhere($column->getName(), 'like', '%'.$search.'%');
                }
            }
        });
    }
public function applySearch ( Builder $ query , \ Illuminate \ Http \ Request $ request ) { $ search = $ request -> input ( 'search.value' ) ; if ( empty ( $ search ) ) { return ; } $ query -> where ( function ( Builder $ query ) use ( $ search ) { $ columns = $ this -> getColumns ( ) -> all ( ) ; foreach ( $ columns as $ column ) { if ( $ column -> isSearchable ( ) ) { if ( $ column instanceof ColumnInterface ) { if ( ( $ metaInstance = $ column -> getMetaData ( ) ) instanceof ColumnMetaInterface ) { if ( method_exists ( $ metaInstance , 'onSearch' ) ) { $ metaInstance -> onSearch ( $ column , $ query , $ search ) ; continue ; } } if ( is_callable ( $ callback = $ column -> getSearchCallback ( ) ) ) { $ callback ( $ column , $ query , $ search ) ; continue ; } } $ query -> orWhere ( $ column -> getName ( ) , 'like' , '%' . $ search . '%' ) ; } } } ) ; }
Apply search to the query.

@param Builder $query
@param \Illuminate\Http\Request $request
Apply search to the query .