Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何通过 Sentinel 获取与用户角色相关的所有用户?我怎样才能在 Sentinel 中获取所有用户?这不起作用:
Sentinel::all()
您可以尝试此操作以获取与特定角色相关的所有用户。
$role = Sentinel::findRoleById(1); // or findRoleBySlug('admin'); for example $users = $role->users()->with('roles')->get();
并且您可以访问第一个用户(依此类推)
dd($users[0]['attributes']);
并让所有用户可以这样做:
$test = Sentinel::getUserRepository(); dd($test);