Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pn523's avatar
Level 2

Get Roles other than assigned

How can I get all the roles for a user which are not assigned to that user ?

0 likes
2 replies
bobbybouwmann's avatar
Level 88

You can do something like this

$currentRoles = $user->roles->pluck('id');

$availableRoles = Role::whereNotIn('id', $currentRoles)->get();

Please or to participate in this conversation.