Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jmrufus's avatar

Creating a ViewAction to Display Related Records

Hello colleagues,

I'm developing an application in Laravel and FilamentPhp, and I'm running into the following problem that I don't know how to solve in Filament.

I have a table of workgroups and another of users with their respective relationships (1:N). I've created the corresponding Resources to manage the CRUD of both entities.

When adding users, I assign each of them the corresponding workgroup.

What I want to do now, and I don't know how, is that when I click on a workgroup in the list of groups, a view is shown with the group data and the users assigned to it.

I've seen that if I create a ViewAction, I can display the group data in a modal, but I'd also like to display the users who belong to the selected group.

Can anyone tell me how I can do this?

Best regards.

0 likes
3 replies
tisuchi's avatar

@jmrufus Unfortunately, it's hard to follow for me. Can you please show your code and explain what you want to do then?

Tray2's avatar

First you need to create a RelationshipManager

php artisan make:filament-relation-manager

In your WorkgroupResource you need to add a relationship manager.

public static function getRelations(): array
{
        return [
            RelationManagers\UsersRelationManager::class,
        ];
}

Then you need to update the table method in your UsersRelationManager. You can use the one from your UsersResource.

 public function table(Table $table): Table
 {
        return UserResource::table($table);
}

Please or to participate in this conversation.