© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
acroninja

Unable to download export with polymorphic user and custom guard

Our export migration uses the
$table->morphs('user');
$table->morphs('user');
and in a service provider i have
Export::polymorphicUserRelationship();
Export::polymorphicUserRelationship();


But accessing the download url redirects me to
/admin/login
/admin/login
even though I am already logged in.

The download route uses the 'filament.actions' middleware group:-

Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware('filament.actions');
Route::get('/filament/exports/{export}/download', DownloadExport::class)
    ->name('filament.exports.download')
    ->middleware('filament.actions');


Which is created in ActionsServiceProvider:-

    public function packageRegistered(): void
    {
        app(Router::class)->middlewareGroup('filament.actions', ['web', 'auth']);
    }
    public function packageRegistered(): void
    {
        app(Router::class)->middlewareGroup('filament.actions', ['web', 'auth']);
    }


(not used by anything else) but I need the
'auth:admin
'auth:admin
middleware.


I did add
$this->app->bind(Authenticatable::class, Admin::class);
$this->app->bind(Authenticatable::class, Admin::class);
also to the service provider but doesn't help, without the correct auth guard we're not going to get that far.

Should i just override the ActionsServiceProvider or is there a better filament way?

Thx for any tips
Solution
Update solved.

A solution is to override filament.actions group. In a service provider add:-

        // Redefine filament actions middleware
        Route::middlewareGroup('filament.actions', [
            'web',
            'auth:admin'> 
        ]);
        // Redefine filament actions middleware
        Route::middlewareGroup('filament.actions', [
            'web',
            'auth:admin'> 
        ]);
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Export with custom guard
FilamentFFilament / ❓┊help
3y ago
Unable to download export file
FilamentFFilament / ❓┊help
17mo ago
Export download logs out with other auth guards and tenants
FilamentFFilament / ❓┊help
15mo ago
Export action using multiple guard
FilamentFFilament / ❓┊help
8mo ago