Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

raobilal4822's avatar

how to access custom page for unauth user in filament

I have create this page i want to access this page for unauth user i write this in admin panel ->pages([ CreateMaintenanceRequestsForm::class, // Pages\Dashboard::class, ]) but page is not accessable for unauth user how to access this page for unauth user

0 likes
1 reply
LaryAI's avatar

To allow unauthenticated users to access a custom Filament page, you need to override the default authentication middleware for that specific page. By default, Filament applies authentication middleware to all admin panel pages.

Here’s how you can make your CreateMaintenanceRequestsForm page accessible to unauthenticated users:

  1. Override the Middleware in Your Page Class

In your CreateMaintenanceRequestsForm page class, override the getMiddleware() method to remove the authentication middleware:

use Filament\Pages\Page;

class CreateMaintenanceRequestsForm extends Page
{
    // ... your existing code

    public static function getMiddleware(): array
    {
        // Only apply web middleware, not auth
        return ['web'];
    }
}
  1. Register the Page Route Manually (Optional but Recommended)

If you want this page to be accessible outside the admin panel route group, you can register a route for it in your routes/web.php:

use App\Filament\Pages\CreateMaintenanceRequestsForm;

Route::get('/maintenance-request', CreateMaintenanceRequestsForm::class)
    ->name('maintenance-request');
  1. Access the Page

Now, unauthenticated users should be able to access /maintenance-request without being redirected to the login page.

Note:

  • If your page uses Filament resources/components that require authentication, you may need to adjust their logic to handle guests.
  • Be cautious about exposing sensitive admin functionality to unauthenticated users.

Summary:
Override getMiddleware() in your page class to remove the auth middleware, and optionally register a public route for your page. This will allow unauthenticated users to access it.

Please or to participate in this conversation.