Skip to content

Exceptions using Query Builder of Laravel #3

Closed
@ozza

Description

@ozza

Hello,

First, thanks for the all of your work.

I am trying to use the Grid component in my Laravel project with eloquent-data-processing library.

It is working well while using eloquent data models, but not working with using the query builder as data source.

I'm using it like:

use DB;
$query = DB::select('select * from table_name where ID = 1');
or
$query = DB::table('table_name')->where('id','=','1');
with
$provider = new EloquentDataProvider($query);

For the first one I'm getting:

InvalidDataSourceException in InvalidDataSourceException.php line 18:
Invalid data source, EloquentDataProvider constructor should be used with Illuminate\Database\Eloquent\Builder instance or Illuminate\Database\Query\Builder instance or class name of target Eloquent model(array given).

And for the second one:

ErrorException in Builder.php line 2345:
Call to undefined method Illuminate\Database\Query\Builder::getQuery()

Obviously I'm doing something wrong. I need to get it work by using raw sql queries. Can you help me with the issue?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions