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

Rretzko's avatar
Level 15

Filament: Route not defined error

Hi all - I misnamed a model when I created it (ePaymentCredentials should have been EpaymentCredentials). I've corrected the model and table but am getting a filament error: "Route [filament.admin.resources.e-payment-credentials.index] not defined." when I try to open Filament.

I've renamed the relevant Filament files (), but when I try to change the directory name to EpaymentCredentialsResouce from ePaymentCredentials Resource, I get a java.io.IOException (Cannot rename ...ePaymentCredentialsResource to EpaymentCredentialsResource).

Any help in fixing this is appreciated!

0 likes
2 replies
LaryAI's avatar
Level 58

To resolve the "Route [filament.admin.resources.e-payment-credentials.index] not defined" error after renaming your model and related files, you need to ensure that all references to the old model name are updated to the new model name. Here are the steps you can follow:

  1. Update Model Name: Ensure that your model class is correctly named EpaymentCredentials and that the corresponding file is named EpaymentCredentials.php.

  2. Update Filament Resource: Ensure that your Filament resource class is correctly named and located in the appropriate directory. The class should be named EpaymentCredentialsResource and the file should be named EpaymentCredentialsResource.php.

  3. Update Namespace and Class References: Make sure that all namespaces and class references within your Filament resource file are updated to reflect the new model name. For example:

<?php

namespace App\Filament\Resources;

use App\Models\EpaymentCredentials;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Resources\Form;

class EpaymentCredentialsResource extends Resource
{
    protected static string $model = EpaymentCredentials::class;

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                // Define your form schema here
            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                // Define your table columns here
            ]);
    }
}
  1. Update Routes: Ensure that the routes for your Filament resource are correctly defined. This is typically done in the routes/web.php or a similar routes file. For example:
use App\Filament\Resources\EpaymentCredentialsResource;

Filament::registerResources([
    EpaymentCredentialsResource::class,
]);
  1. Clear Cache: After making these changes, clear your application cache to ensure that the old routes and configurations are not being used. You can do this by running the following Artisan commands:
php artisan route:clear
php artisan config:clear
php artisan cache:clear
  1. Check Filament Configuration: Ensure that your Filament configuration files do not contain any references to the old model name. This might include configuration files in the config directory or any custom Filament configuration files.

By following these steps, you should be able to resolve the "Route [filament.admin.resources.e-payment-credentials.index] not defined" error and ensure that your Filament resource is correctly registered and accessible.

MiguelBarros's avatar

Why dont you regenerate everything again by executing the command:

php artisan make:filament-resource EpaymentCredentials --generate

and after that delete the resource with wrong name.

Then execute

php artisan optimize:clear

And it should fix the problem!

Please or to participate in this conversation.