Outdated

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

View 3.x docs →

Usage

In filament 3, the package ships one action class per context. Import the one matching the place you use it in.

In a table

use Guava\FilamentModalRelationManagers\Actions\Table\RelationManagerAction;

public static function table(Table $table): Table
{
    return $table
        ->actions([
            RelationManagerAction::make('lesson-relation-manager')
                ->label('View lessons')
                ->relationManager(LessonRelationManager::make()),
        ]);
}

In an infolist

use Guava\FilamentModalRelationManagers\Actions\Infolist\RelationManagerAction;

TextEntry::make('title')
    ->suffixAction(
        RelationManagerAction::make()
            ->label('View lessons')
            ->relationManager(LessonRelationManager::make()),
    );

As a page action

use Guava\FilamentModalRelationManagers\Actions\Action\RelationManagerAction;

protected function getHeaderActions(): array
{
    return [
        RelationManagerAction::make()
            ->label('View lessons')
            ->record($this->getRecord())
            ->relationManager(LessonRelationManager::make()),
    ];
}

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