F
Filamentβ€’7mo ago
oks_voice123

ok simple request on table TextColumn

How can I for a table populate a colum(A) with the value of another column(B) from the same row if the cell/column A is empty ? Placeholder or default doesn't permit to be dynamic Sorry for this simple question but as newbie I'm still learning and sometimes I'm not so experienced to find the best approach / solution to implement Many thanks
Solution:
->state(fn(YourModel $record) => $record->column_a ?? $record->column_b) ?...
Jump to solution
3 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’7mo ago
->state(fn(YourModel $record) => $record->column_a ?? $record->column_b) ?
Dan Harrin
Dan Harrinβ€’7mo ago
or default(fn $record i think
oks_voice123
oks_voice123OPβ€’7mo ago
Many thanks , @Leandro Ferreira and @Dan Harrin , both solutions are working like expected ! As I will not use this all the time , I will use the state option as it is easier to remember that it will check the state of the field πŸ™‚ and in the documentation of my project it will be easier to understand but your proposition Dan is also working fine As newbie , I discovered Filament 2...3 weeks ago and it is really amazing what we can do with all you have developped @Dan Harrin and teams !!!! A big thank you for the amazing work and involvement !
Want results from more Discord servers?
Add your server