createOption visivility according to permissions.

Is there a way to hide createOption button when a user does not have permission to model.create?
6 Replies
awcodes
awcodes2y ago
If they don’t have permission to create then they shouldn’t even be able to access the page.
Otávio Araújo
Otávio AraújoOP2y ago
No... I mean The createOption from select field....
awcodes
awcodes2y ago
Ah. What have you tried? It might just work out of the box with a policy for that model.
Otávio Araújo
Otávio AraújoOP2y ago
I didnt... I Just saw that for example of State that hasMany cities... On The City's form, and in The States select field, if user does not have peemittion for States.create it still shows createOption button. I thoght that it shloud not happen... And im a newbie yet... I Code lika a Hobbie, you know... Like learning and consuming php and laravel skills...
awcodes
awcodes2y ago
I’d start with making a policy for the model that is used in the relationship for the select field.
Otávio Araújo
Otávio AraújoOP2y ago
Yep... Thank you!

Did you find this page helpful?