© 2026 Hedgehog Software, LLC

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

canAccess() method not working when added to Custom Page

What I am trying to do:
I was trying to use the canAccess() method to authorise certain User's access to a custom Filament page. I want it to remove the navigation menu item.

What I did:
Create a page using filament:create-page, add the canAccess method and make it always return false to test it.

My issue:
The menu item has not been removed.

I cannot see any reference to this function in the inherited classes, so a bit lost on how Filament actually uses it.

Code:
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class TestPage extends Page
{
    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.test-page';

    public static function canAccess(): bool
    {
        return false;
    }
}
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class TestPage extends Page
{
    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.test-page';

    public static function canAccess(): bool
    {
        return false;
    }
}


Docs link: https://filamentphp.com/docs/3.x/panels/pages#authorization
image.png
Solution
Jump to solution
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

Custom Page canAccess runs after mount ?
FilamentFFilament / ❓┊help
16mo ago
Cluster page canAccess is being run when not going to that route.
FilamentFFilament / ❓┊help
14mo ago
formatStateUsing method in TextColumn is not working at the custom page
FilamentFFilament / ❓┊help
2y ago
getPages not working on Custom Page
FilamentFFilament / ❓┊help
9mo ago