Unable to download export with polymorphic user and custom guard

Our export migration uses the $table->morphs('user'); and in a service provider i have Export::polymorphicUserRelationship(); But accessing the download url redirects me to /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 middleware. I did add $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:- ```php...
Jump to solution
1 Reply
Solution
acroninja
acroninja8mo ago
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'>
]);
Want results from more Discord servers?
Add your server