© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•11mo ago•
1 reply
Batman

Test for current route (or query params)

I have a tab in
ListUsers::class
ListUsers::class
that only a Super Admin can see. If an Admin tries to view the route by directly putting it into the url, it correctly returns the first tab. This seems to be default behavior of Filament and is what I desire. Since it is not a redirect, and is the same component, I am having a hard time finding out how to correctly test that the url actually returned is
ListUsers::class [activeTab=all]
ListUsers::class [activeTab=all]
or
admin/users?activeTab=all
admin/users?activeTab=all
.

Getting the current URL or Route returns a Livewire Testing Endpoint.

Any help is appreciated.

it('disallows admins from viewing tab for deleted users', function () {
    asAdmin();

    livewire(ListUsers::class, ['activeTab=deleted']);
    // assert that the current route is actually equal to: 
    // ListUsers::class, ['activeTab=all']
});
it('disallows admins from viewing tab for deleted users', function () {
    asAdmin();

    livewire(ListUsers::class, ['activeTab=deleted']);
    // assert that the current route is actually equal to: 
    // ListUsers::class, ['activeTab=all']
});
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

route current
FilamentFFilament / ❓┊help
3y ago
How to get current route and params inside updateStateUsing?
FilamentFFilament / ❓┊help
3y ago
`null` query params
FilamentFFilament / ❓┊help
3y ago
Test: Route not defined
FilamentFFilament / ❓┊help
3y ago