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
I can't get any idea to get the current model
->hidden(fn (?) => ... )
Have you tried
->hidden(fn (YourModel $record) => $record->relationship()->count() > 5)
?Filament
Actions - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
its probably
$livewire->ownerRecord->relationship()
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