Saving relationships
I have a relationship set in my User form for managing roles, however I want to add some logic for role checking to make it so admins cant modify super admin roles and other roles cant modify admin and super admin roles etc
6 Replies
My issue is that I cant seem to modify the logic before saving. I can remove the roles from the dropdown, but the saveRelationshipUsing where I have a dd() never gets hit
Solution
I would suggest you use a rule instead and prevent it?
Ah yeah, that makes sense.\
Actually got another question with this. So the rule validation works and stops me from being allowed to remove my role. But I've also added a disableOptionWhen so that it cant be touched, but doesn't seem to be exactly what im after... in the case of, when a user is already admin, I want them to see admin selected but remove the ability to click the x that removes it

So I realise the disableOptionWhen is for the preventing of selecting from the list, so don't think that is exactly what im after
Yeah…. It’s not really what you’re after, why not just hide the role? so they can’t remove it/see their primary role