© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
groenewege

How to test with multi-tenancy ?

When I want to test a create form on a multi-tenant aware panel, I get an error because the index route is missing the tenant parameter.
I think this is the index route used by the "cancel" button.
How do I inject the correct tenant in my test to prevent this error ?

Here is my code :

test('superadmin can create admin', function () {
    $this->signInAsSuperAdmin();
    livewire(CreateSuperadmin::class)
        ->fillForm([
            'name' => 'New Admin',
            'email' => 'test@test.com',
            'password' => 'password',
        ])
        ->call('create')
        ->assertHasNoFormErrors();

    $this->assertDatabaseHas(User::class, [
        'name' => 'New Admin',
        'email' => 'test@test.com',
    ]);
});
test('superadmin can create admin', function () {
    $this->signInAsSuperAdmin();
    livewire(CreateSuperadmin::class)
        ->fillForm([
            'name' => 'New Admin',
            'email' => 'test@test.com',
            'password' => 'password',
        ])
        ->call('create')
        ->assertHasNoFormErrors();

    $this->assertDatabaseHas(User::class, [
        'name' => 'New Admin',
        'email' => 'test@test.com',
    ]);
});


Although it is the create page, I get the following error :
Missing required parameter for [Route: filament.admin.resources.superadmin.index]
Missing required parameter for [Route: filament.admin.resources.superadmin.index]
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

Multi Tenancy within multi tenancy
FilamentFFilament / ❓┊help
2y ago
Fabricator With Multi-Tenancy
FilamentFFilament / ❓┊help
2y ago
Multi tenancy with filament
FilamentFFilament / ❓┊help
2y ago
Multi-tenancy with Shield
FilamentFFilament / ❓┊help
3y ago