createOptionUsing on select not called in livewire component
Hey guys,
I tried to add a form to a livewire component which works really well.
Now I created a select field (Tag) with a relationship with the option to add a new Tag.
I created "createOptionForm" on the select which is working fine and I wanted to include a logic, that it returns firstOrCreate on that creation.
I added "createOptionUsing" as well, but unfortunately this method is not called somehow. I don't know why this is not working.. :/
Has someone an idea?
My code:
blade:
I tried to add a form to a livewire component which works really well.
Now I created a select field (Tag) with a relationship with the option to add a new Tag.
I created "createOptionForm" on the select which is working fine and I wanted to include a logic, that it returns firstOrCreate on that creation.
I added "createOptionUsing" as well, but unfortunately this method is not called somehow. I don't know why this is not working.. :/
Has someone an idea?
My code:
blade:
Solution
found the problem:
->relationship has much functions inside - including createOptionUsing, which overwrites my own function.
placing "->relationship" on top of "->createOptionUsing" works..
->relationship has much functions inside - including createOptionUsing, which overwrites my own function.
placing "->relationship" on top of "->createOptionUsing" works..