KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Laravel Eloquent ORM in reports #777

Closed SOFMAN opened this topic on on Apr 3, 2019 - 1 comments

SOFMAN commented on Apr 3, 2019

Is it the correct way to use laravel eloquent queries, I have done in the following way but it does not work inside koolreport.

  DataTables::create(array(
    "dataSource"=>\App\Model\Usuario::all()              
 ));
KoolReport commented on Apr 4, 2019

Currently you need to make a query like this:

  DataTables::create(array(
    "dataSource"=>$this->src("mysql")->query("SELECT * from tbl_usaurio"),
 ));

or if you are using querybuilder, you can do:

  DataTables::create(array(
    "dataSource"=>$this->src("mysql")->query(DB::table("tbl_usaurio"))
 ));

FYI, In the next version of Laravel package, we will provide way to make koolreport widgets work with Laravel using eloquent.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None