© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6mo ago•
1 reply
Merdin

Testing relation manager (that is a nested resource)

What I am trying to do:
I'm trying to write a test for the relation manager of a resource that is nested. (One project has many assignments).

What I did:
I wrote a test according to the documentation.

The tests with relation managers but that are not a nested resource do pass.

My issue/the error:
Missing required parameter for [Route: filament.app.ppm.resources.projects.assignments.view] [URI: ppm/projects/{project}/assignments/{record}] [Missing parameter: project].
Missing required parameter for [Route: filament.app.ppm.resources.projects.assignments.view] [URI: ppm/projects/{project}/assignments/{record}] [Missing parameter: project].


Code:
it('can redirect to view assignment page', function () {
    $user = createUserWithPermissions(['view projects', 'update projects', 'view assignments', 'create assignments']);
    actingAs($user);

    $project = Project::factory()->hasAssignments(2)->create();

    livewire(AssignmentsRelationManager::class, [
        'ownerRecord' => $project,
        'pageClass' => ViewProject::class,
    ])
        ->assertOk()
        ->assertCanSeeTableRecords($project->assignments);
});
it('can redirect to view assignment page', function () {
    $user = createUserWithPermissions(['view projects', 'update projects', 'view assignments', 'create assignments']);
    actingAs($user);

    $project = Project::factory()->hasAssignments(2)->create();

    livewire(AssignmentsRelationManager::class, [
        'ownerRecord' => $project,
        'pageClass' => ViewProject::class,
    ])
        ->assertOk()
        ->assertCanSeeTableRecords($project->assignments);
});
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Relation Manager not visible in Nested Resource
FilamentFFilament / ❓┊help
8mo ago
Testing relation manager actions
FilamentFFilament / ❓┊help
12mo ago
Testing Filament Relation Manager
FilamentFFilament / ❓┊help
2y ago
Testing a HintAction in a Relation Manager
FilamentFFilament / ❓┊help
2y ago