Ok I found. I'm new with Laravel so I'm not familiar with some notions.
I modified the class "SentinelUserRepository" in "Modules\User\Repositories\Sentinel" and I added a new method.
/**
* Returns all the users with roles
* @return object
*/
public function allWithRoles()
{
return $this->user->with('roles')->get();
}
Then in the API Controller, now I call the new method:
public function index(UserRepository $user)
{
$users = $user->allWithRoles();
return response()->json($users);
}
If you have a better idea...