F
Filamentβ€’7mo ago
Sairahcaz2k

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!
Solution:
Works now, guess it was a problem with the casting!
Jump to solution
3 Replies
awcodes
awcodesβ€’7mo ago
Is your array keyed with color1 color2 etc?
Sairahcaz2k
Sairahcaz2kOPβ€’7mo ago
Yes it is πŸ‘
Solution
Sairahcaz2k
Sairahcaz2kβ€’7mo ago
Works now, guess it was a problem with the casting!
Want results from more Discord servers?
Add your server