Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’3y agoβ€’
1 reply
Demon-CZ

Attach relation manager

Hello, I am little bit confused in relationships. πŸ˜… Can somebody help me with this please?

I have EventResource in it OrganizersRelationManager in it i want to attach and deattach organizers(which has model Customer).

Error: https://flareapp.io/share/o7A9Gqj7

Code OrganizesRelationManager:
class OrganizersRelationManager extends RelationManager
{
    protected static string $relationship = 'organizers';

    public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('name')
            ->columns([
                Tables\Columns\TextColumn::make('name'),
            ])
            ->filters([
                //
            ])
            ->headerActions([
                Tables\Actions\AttachAction::make(),
            ])
            ->actions([
                Tables\Actions\DetachAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DetachBulkAction::make(),
                ]),
            ]);
    }
}
class OrganizersRelationManager extends RelationManager
{
    protected static string $relationship = 'organizers';

    public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('name')
            ->columns([
                Tables\Columns\TextColumn::make('name'),
            ])
            ->filters([
                //
            ])
            ->headerActions([
                Tables\Actions\AttachAction::make(),
            ])
            ->actions([
                Tables\Actions\DetachAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DetachBulkAction::make(),
                ]),
            ]);
    }
}


Relationship in event:
public function organizers()
    {
        return $this->belongsToMany(Customer::class,'event_organizer', 'event_id', 'customer_id');
    }
public function organizers()
    {
        return $this->belongsToMany(Customer::class,'event_organizer', 'event_id', 'customer_id');
    }


Relationship in Customer:
public function organizers()
    {
        return $this->belongsToMany(Event::class,'event_organizer', 'customer_id', 'event_id');
    }
public function organizers()
    {
        return $this->belongsToMany(Event::class,'event_organizer', 'customer_id', 'event_id');
    }
Flare
Call to undefined method App\Models\Customer::events() - The error occurred at http://localhost/admin/events/3/edit
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel β€’ Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Attach Relation Manager
FilamentFFilament / β“β”Šhelp
3y ago
Relation manager attach one-to-many
FilamentFFilament / β“β”Šhelp
3y ago
Visible for Attach Action In Relation Manager
FilamentFFilament / β“β”Šhelp
2y ago
Relation Manager Resource with pivot - Custom Attach
FilamentFFilament / β“β”Šhelp
3y ago