Conditionally hide attach action

How to conditionally hide attach action when the relationships has reached n rows? A little note: for this case I don't want to use model policy
5 Replies
IndomieRendang
IndomieRendangOP2y ago
I can't get any idea to get the current model ->hidden(fn (?) => ... )
Kenneth Sese
Kenneth Sese2y ago
Have you tried ->hidden(fn (YourModel $record) => $record->relationship()->count() > 5)?
Kenneth Sese
Kenneth Sese2y ago
Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
Dan Harrin
Dan Harrin2y ago
its probably $livewire->ownerRecord->relationship()
IndomieRendang
IndomieRendangOP2y ago
Thanks for your help but $record didn't help since I think it refers to a table record while attach is almost the same with create and doesn't have any $record yet Thank you this works
Want results from more Discord servers?
Add your server