FilamentF
Filament3y ago
Greg

Arbitrary values for table column

I've got a Resource component that maps to Auditions in my app. An Audition HasMany Dates which also HasMany Slots and those Slots have a user_id to indicate whether anyone has signed up for them. I want to add a column that displays the count of "sign ups" - slots with a non-null user_id.

I've used ->counts for another column but I don't think the same syntax works for a 2nd order relation along with a condition.

Starting from $this representing the Audition model, I can easily create the value I want to display but I don't know how to incorporate arbitrary code in the TableBuilder. Is that possible?

Thank you!
Solution
I'm not sure whether you're trying to display this new calculation next to Auditions, or next to Dates.
But I would expect using dot-notation and a whereNotNull() query clause would be the direction to go
Was this page helpful?