Outdated

You are reading the documentation for 2.x. The current version is 3.x.

View 3.x docs →

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();
guava/filament-modal-relation-managers 86K installs · 79 stars
// COOKIES

A few cookies keep the site working; others remember preferences or count visits. You choose what runs.

Cookie policy