© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Samir

Attach in relationship manager is Timing out

Admin panel has Product and Seller resources with a many-to-many relationship. Sellers, treated as authenticatable users, can't create products but can select/add from Admin's product list. Admin's relationship manager works well. In Seller Resource, Admin can view/edit a seller and manage their products efficiently. However, attaching products is slow. In the Seller panel, the user can view their products but faces timeouts in attaching due to slow select searches, even with preload implementation. In Seller Panel, I have created a Filament Custom page called Products and add below code in the component. Below is the code. What is wrong.
class Products extends Page implements HasForms, HasTable
{
    use InteractsWithTable;
    use InteractsWithForms;

    protected static string $view = 'filament.seller.pages.products';

    public Seller $seller;

     public function mount(Seller $seller): void
    {
        $seller = Filament::auth()->user();
        $this->seller = $seller;
    }

    public function table(Table $table): Table
    {
        return $table
            ->relationship(fn (): BelongsToMany => $this->seller->products())
            ->inverseRelationship('sellers')
            ->columns([
                Tables\Columns\TextColumn::make('name’),

                ————other table columns ——— 

            ])
            ->headerActions([
                Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect(),
            ])
            ->actions([
                Tables\Actions\DetachAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DetachBulkAction::make(),
                ]),
            ]);
    }

}
class Products extends Page implements HasForms, HasTable
{
    use InteractsWithTable;
    use InteractsWithForms;

    protected static string $view = 'filament.seller.pages.products';

    public Seller $seller;

     public function mount(Seller $seller): void
    {
        $seller = Filament::auth()->user();
        $this->seller = $seller;
    }

    public function table(Table $table): Table
    {
        return $table
            ->relationship(fn (): BelongsToMany => $this->seller->products())
            ->inverseRelationship('sellers')
            ->columns([
                Tables\Columns\TextColumn::make('name’),

                ————other table columns ——— 

            ])
            ->headerActions([
                Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect(),
            ])
            ->actions([
                Tables\Actions\DetachAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DetachBulkAction::make(),
                ]),
            ]);
    }

}
I dont get any error while while viewing my record as a Seller in my Seller panel. I can detach if admin panel has added products for me. Please help.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

format options on relationship manager select in attach form
FilamentFFilament / ❓┊help
3y ago
Laravel filament relationship manager (attach two belongtomany attribute)
FilamentFFilament / ❓┊help
3y ago
Select field ->preload() not working in relationship manager attach action
FilamentFFilament / ❓┊help
3y ago
Attach relation manager
FilamentFFilament / ❓┊help
3y ago