public function search($payload)
    {
        $query = $this->model->orderBy('created_at', 'desc');
        $query->where('id', 'LIKE', '%'.$payload['term'].'%');

        $columns = Schema::getColumnListing($this->table);

        foreach ($columns as $attribute) {
            $query->orWhere($attribute, 'LIKE', '%'.$payload['term'].'%');
        }

        return [$query, $payload['term'], $query->paginate(25)->render()];
    }
public function search($payload)
    {
        $query = $this->model->orderBy('created_at', 'desc');
        $query->where('id', 'LIKE', '%'.$payload['term'].'%');

        $columns = Schema::getColumnListing($this->table);

        foreach ($columns as $attribute) {
            $query->orWhere($attribute, 'LIKE', '%'.$payload['term'].'%');
        }

        return [$query, $payload['term'], $query->paginate(25)->render()];
    }
public function search ( $ payload ) { $ query = $ this -> model -> orderBy ( 'created_at' , 'desc' ) ; $ query -> where ( 'id' , 'LIKE' , '%' . $ payload [ 'term' ] . '%' ) ; $ columns = Schema :: getColumnListing ( $ this -> table ) ; foreach ( $ columns as $ attribute ) { $ query -> orWhere ( $ attribute , 'LIKE' , '%' . $ payload [ 'term' ] . '%' ) ; } return [ $ query , $ payload [ 'term' ] , $ query -> paginate ( 25 ) -> render ( ) ] ; }
Search the columns of a given table

@param  array $payload

@return array
Search the columns of a given table