Is it possible to bind a json column or maybe multiple columns to one custom field?
Hey folks,
filament noob here...
I have a custom field, for instance:
ColorPicker::make('colors')
if I provide json/array (casted in the model) it doesn't work:
<div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
<input type="color" x-model="state.color1">
<input type="color" x-model="state.color2">
</div>
But if colors is just a string it works:
<div x-data="{ state: $wire.$entangle('{{ $getStatePath() }}') }">
<input type="color" x-model="state">
</div>
Or is there maybe a way to bind multiple columns to a single component?, this would also help.
Maybe something like this?:
CustomField::make('foo', 'bar')
Any references, where I can learn more about this are highly appreciated!
Thanks!
3 Replies
Is your array keyed with color1 color2 etc?
Yes it is π
Solution
Works now, guess it was a problem with the casting!