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

VolkanOner's avatar

FilamentPHP Relation Manager Modal to Direct Page

Hi. In my project, i use classic panel by filamentphp. classic rules and stuff from documentation. with relation manager, i can list products on category edit page. this product list belongs to this specific category. okey. no problem here. but when i visit the category edit page and click the one of the product edit link, this opens a modal. i dont want that. i wanna click the edit button end go to product edit page. because, products has variables. variables has images etc. like tree, i wanna click and go to detail... i hope anybody understand this situation.

0 likes
7 replies
LaryAI's avatar
Level 58

To achieve the behavior you want, where clicking the edit button on a related product takes you to the product edit page instead of opening a modal, you can customize the actions in your Relation Manager.

Here's how you can override the default edit action to redirect to the product edit page:

use Filament\Resources\Form;
use Filament\Resources\Table;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Actions\LinkAction;

class ProductsRelationManager extends RelationManager
{
    protected static string $relationship = 'products';

    protected function getTableActions(): array
    {
        return [
            LinkAction::make('edit')
                ->url(fn ($record): string => route('filament.resources.products.edit', ['record' => $record]))
                ->icon('heroicon-s-pencil'),
            // ... other actions
        ];
    }

    // ... other methods
}

In this example, we're using LinkAction to create a link that will take the user to the product edit page. Make sure to replace 'filament.resources.products.edit' with the actual named route to your product edit page.

Remember to register your custom Relation Manager in your Category resource:

use Filament\Resources\Resource;
use App\Filament\RelationManagers\ProductsRelationManager;

class CategoryResource extends Resource
{
    // ...

    public static function getRelations(): array
    {
        return [
            ProductsRelationManager::class,
            // ... other relation managers
        ];
    }

    // ...
}

Now, when you click the edit button for a product in the category edit page, it should take you directly to the product edit page instead of opening a modal. Make sure to clear your cache and recompile your assets if necessary to see the changes take effect.

VolkanOner's avatar

Ok AI handled this. after fix the little route error, this solution is working.

route fix => filament.admin.resources.products.edit

VolkanOner's avatar

Maybe i cant see but it seems to "LinkAction" class not on the filamentphp documentation. i searched and looked at the actions docs. couldn't find it in the docs. Bravo Lary.

Edit: Php Storm warning: Class 'LinkAction' is deprecated (but it working)

eenprogrammeur's avatar
Level 1

@VolkanOner

use Filament\Tables\Actions\Action;

Action::make('details')
    ->label('')
    ->url(fn ($record): string => route('filament.admin.resources.products.edit', ['record' => $record]))
    ->icon('heroicon-s-eye')
    ->color('info')
4 likes
hayespdx's avatar

Another option, if you don't want to show an icon, is to link one of the fields in the table, such as the ID:

Tables\Columns\TextColumn::make('id')
            ->label('ID')
            ->url(fn ($record): string => route('filament.admin.resources.'.$record->getTable().'.edit', ['record' => $record]))

(I get the resource name dynamically because I generate table columns automatically in a separate class. I left it in there just in case it's useful to someone.)

holmesadam's avatar

In the page that I'm linking to, I have a dropdown so I can set the parent ID. Is there a way to do this with ->url() - when using a slideover, I can use ->fillForm() to set the ID, but this doesn't seem to work with url. The page I'm linking to is a create page which comes from a CreateAction

yukebrillianth's avatar
Tables\Actions\ViewAction::make()->url(fn($record): string => ProjectResource::getUrl('view', ['record' => $record])),
1 like

Please or to participate in this conversation.