Usage
Since filament 4 unified its actions, there is a single RelationManagerAction class that works everywhere: tables, schemas (forms and infolists) and page actions.
In a table
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
return $table
->recordActions([
RelationManagerAction::make('lesson-relation-manager')
->label('View lessons')
->relationManager(LessonRelationManager::class),
]);
In a schema
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
TextEntry::make('title')
->suffixAction(
RelationManagerAction::make()
->label('View lessons')
->relationManager(LessonRelationManager::class),
);
As a page action
use Guava\FilamentModalRelationManagers\Actions\RelationManagerAction;
protected function getHeaderActions(): array
{
return [
RelationManagerAction::make()
->label('View lessons')
->record($this->getRecord())
->relationManager(LessonRelationManager::class),
];
}
Customization
Hide the relation manager's heading inside the modal (it is hidden by default):
RelationManagerAction::make()
->hideRelationManagerHeading();
Use the compact style, which removes the padding around the table so it touches the modal's edge:
RelationManagerAction::make()
->compact();