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.
権限「x」を持つユーザーのリストを表示したかったのです。役割/権限を管理するために、laravel 5.1 で zizaco/entrust プラグインを使用しています。私はすでに役割と権限を設定しています。以前は役割を扱っていましたが、仕様の変更により、権限が必要になります。
使用できますwhereHas():
whereHas()
$permissionName = 'x'; $userList = User::whereHas('roles.perms', function($query) use ($permissionName) { $query->whereName($permissionName); })->get(); dd($userList);