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.