laravel - Specific Method in Laravel5.4 Yajra Datatable -
when i'm using normal query of datatable works,
public function gethmodatatable() { $hmo = hmo::query(); return datatables::eloquent($hmo) ->addcolumn('action', function($row) { return '<a href="/hmo/principal/'. $row->id .'/edit" class="btn btn-primary">update</a>'; }) ->make(true); }
but when i'm using specific query attached, doesnt work
public function gethmopendingdatatable() { $hmo = hmo::gethmopending(); return datatables::eloquent($hmo) ->addcolumn('action', function($row) { return '<a href="/hmo/principal/pending'. $row->id .'/edit" class="btn btn-primary">update</a>'; }) ->make(true); }
what did follow new way of https://github.com/yajra/laravel-datatables can use whatever need
return datatables()->of(user::query())->tojson(); return datatables()->of(db::table('users'))->tojson(); return datatables()->of(user::all())->tojson(); return datatables()->eloquent(user::query())->tojson(); return datatables()->querybuilder(db::table('users'))->tojson(); return datatables()->collection(user::all())->tojson(); return datatables(user::query())->tojson(); return datatables(db::table('users'))->tojson(); return datatables(user::all())->tojson();
here code
public function gethmopendingdatatable() { return datatables()->of(hmo::gethmopending()) ->addcolumn('action', function($row) { return '<a href="/hmo/principal/'. $row->id .'/edit" class="btn btn-primary">update</a>'; }) ->make(true); }
Comments
Post a Comment