© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
15 replies
bwdev1

Different log-in behaviour depending on user role

Hi, I have two types of users - 'admin' and 'client'.
I'd like to use the same log-in page for all users, however if the user is an 'admin', then they should be redirected to the filament dashboard on successful login (url is /admin which i think is the default behaviour of canAccessPanel), while clients should be redirected to their own dashboard (url /dashboard).

The current code I have below doesn't work at the moment for clients, but it is a good starting point I believe. The issue with canAccessPanel is that on log in, clients are able to log in but are met with a

    public function canAccessPanel(Panel $panel): bool
    {
        if ($panel->getId() === 'admin') {
            if ($this->role == 'admin') {
                return true;
            }
            if ($this->role == 'client') {
                return false;
            }
        }
    }
    public function canAccessPanel(Panel $panel): bool
    {
        if ($panel->getId() === 'admin') {
            if ($this->role == 'admin') {
                return true;
            }
            if ($this->role == 'client') {
                return false;
            }
        }
    }
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

Show different records depending on user roles
FilamentFFilament / ❓┊help
2y ago
menu item depending on user role or permission
FilamentFFilament / ❓┊help
3y ago
Dropdown access depending on role
FilamentFFilament / ❓┊help
3y ago
How to hide dashboard from "Dashboard" depending on user role?
FilamentFFilament / ❓┊help
16mo ago