How to asign to a hidden form field a role?

i tried:
Hidden::make('roles')
->relationship('roles', 'name')
->saveRelationshipsWhenHidden()
->default('User'),
Hidden::make('roles')
->relationship('roles', 'name')
->saveRelationshipsWhenHidden()
->default('User'),
` but doesnt work.
3 Replies
Patrick Boivin
Patrick Boivin14mo ago
Can you talk a bit more about what you are trying to do?
Dan Harrin
Dan Harrin14mo ago
attach the role in an observer dont use a hidden field, they are not built for this
Falk Maria Zeitsprung
thanks