Using trait hasAssignees for Select in form
Hi all,
I have a Trait called HasAssignees
Which i want to use to populate a SelectField in a form with list of users which would be assigned to a model (task, Booking etc).
This is the model
and the db structure for the trait
I "think" the answer lies in the self:: but i am a bit stuck
can anyone assist how i can show a select field to display the assignees of that record?
Thanks in advance!!
3 Replies
I think i may be overengineering this - just simple has many relationship on model
Hi @cvc_web, I'm not sure but something looks off about the
morphToMany()
... are you able to use the relationship?
To your question, you can use a query for the options of a select field, something like this:
This would only work on edit obviously...Hi yes, I think i got in my own brain trying to use a trait! I eventually went for Pivot Table and one to Many relationship. but thanks for the help anyway - it did work on the edit - but adding became more of a hell