FilamentF
Filament8mo ago
Marek

Route not found for Filament Resource Page

I'm an experienced PHP/Symfony developer, my experience with Laravel and Filament is very limited. I apologise in advance for a trivial question.

I created a new Resource, with two pages: index, and issue. Autodiscovery seems to work fine, when I run the route:list command from the command line, I see the routes:
$ php artisan route:list | grep premiums
  GET|HEAD   admin/premiums ................................ filament.app.resources.premiums.index › App\Filament\Resources\PremiumResource\Pages\ListPremiums
  GET|HEAD   admin/premiums/{record}/issue ................. filament.app.resources.premiums.issue › App\Filament\Resources\PremiumResource\Pages\IssuePremium

When I try to use the route in Filament's Action, I get the following error:
Internal Server Error

Symfony\Component\Routing\Exception\RouteNotFoundException
Route [filament.app.resources.premiums.issue] not defined.

Well, clearly it's defined, as route:list lists that route... so not sure what is going on here.

I have tried clearing cache, restarting the app, even restarted my PC.

The relevant PHP code that tries to use the route is:
            ->actions([
                Action::make('premiums.issue')
                    ->label('Issue')
                    ->url(fn (Premium $p) => route('filament.app.resources.premiums.issue', ['record' => $p->id]))
                ,
            ])

PremiumResource class:
final class PremiumResource extends Resource
{
    protected static ?string $model = Premium::class;

    protected static ?string $navigationGroup = null;
    protected static ?int $navigationSort = null;

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListPremiums::route('/'),
            'issue' => Pages\IssuePremium::route('/{record}/issue'),
        ];
    }
}

ListPremiums extends ListRecords, while IssuePremium extends EditRecord.

Thank you.
Solution
I deleted bootstrap/cache/filament folder and now it automagically works...
Was this page helpful?