Sep 7, 2017
0
Level 1
Displaying record using Datatables from 3 tables
Hi there, I started to use Yajra Datatables and Spatie Permission for my project, and I got confuse. But I managed to show the results with no error, like this
{"draw":0,"recordsTotal":4,"recordsFiltered":4,"data": and so on
As for the tables are: users, roles, user_has_roles. Here's the controller
public function userList()
{
$user = User::with('roles')->select('users.*');
return Datatables::of($user)->make(true);
}
Anything to change so the table will become something like this: | # | ID | username | email | roles |
for the ID, username and email, already displayed, except "roles". Note: the "user_has_roles" already include at the result without I did anything at all Thank you.
Please or to participate in this conversation.