F
Filament15mo ago
TiBiBa

Associate headerAction not showing on Relation manager?

Hi! We've just migrated to v3 and have some issues with a HasMany relation and the AssociateAction. When adding an AssociateAction to the headerActions of the Relation Manager table the action button is not shown. Using the following snippet the normal action is displayed as expected but the associate action is not. I didn't run into this issue with v2 and unable to find a cause, thanks in advance!
->headerActions([ Tables\Actions\Action::make('test123'),
Tables\Actions\AssociateAction::make(),
])
->headerActions([ Tables\Actions\Action::make('test123'),
Tables\Actions\AssociateAction::make(),
])
Edit I run into the same issue with an Edit and Delete action on the items. The View action is rendered as expected. However, Detach actions in turn don't work either. I've tried this accross multiple relation managers.
Solution:
Just found a solution. This is due to the relations only being readOnly on view by default. Hiding all actions that can mutate the relation (so all instead of the view). Adding the following to your relation is the fix: ``` public function isReadOnly(): bool { return false;...
Jump to solution
1 Reply
Solution
TiBiBa
TiBiBa15mo ago
Just found a solution. This is due to the relations only being readOnly on view by default. Hiding all actions that can mutate the relation (so all instead of the view). Adding the following to your relation is the fix:
public function isReadOnly(): bool
{
return false;
}
public function isReadOnly(): bool
{
return false;
}
Want results from more Discord servers?
Add your server