src/BaseRepositoryEloquent.php
public function search($input, $compareAttributes = ['*'], $attributes = ['*'])
    {
        $query = $this->query();

        $compareAttributes = $compareAttributes ?: ['*'];

        if ($compareAttributes == ['*']) {
            $compareAttributes = Schema::getColumnListing($this->model->getTable());
        }

        foreach ($compareAttributes as $column) {
            $query->orWhere($column, 'like', '%'.join('%', str_split($input)).'%');
        }

        return $query->get($this->selectAttributes($attributes));
    }
public function search($input, $compareAttributes = ['*'], $attributes = ['*'])
    {
        $query = $this->query();

        $compareAttributes = $compareAttributes ?: ['*'];

        if ($compareAttributes == ['*']) {
            $compareAttributes = Schema::getColumnListing($this->model->getTable());
        }

        foreach ($compareAttributes as $column) {
            $query->orWhere($column, 'like', '%'.join('%', str_split($input)).'%');
        }

        return $query->get($this->selectAttributes($attributes));
    }
public function search ( $ input , $ compareAttributes = [ '*' ] , $ attributes = [ '*' ] ) { $ query = $ this -> query ( ) ; $ compareAttributes = $ compareAttributes ? : [ '*' ] ; if ( $ compareAttributes == [ '*' ] ) { $ compareAttributes = Schema :: getColumnListing ( $ this -> model -> getTable ( ) ) ; } foreach ( $ compareAttributes as $ column ) { $ query -> orWhere ( $ column , 'like' , '%' . join ( '%' , str_split ( $ input ) ) . '%' ) ; } return $ query -> get ( $ this -> selectAttributes ( $ attributes ) ) ; }
Search any input against the given attributes.

@param  string                                   $input
@param  array                                    $compareAttributes
@param  array                                    $attributes
@return \Illuminate\Database\Eloquent\Collection
Search any input against the given attributes .