© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
guitarnerd_

Issues with Attach/Associate action between a belongsTo/hasMany relationship

Hi everyone,

I have a model called Order and another called OrderStatus.

The relevant realtionships are the following:

Order.php

 public function orderStatus()
    {
        return $this->belongsTo(OrderStatus::class);
    }
Order.php

 public function orderStatus()
    {
        return $this->belongsTo(OrderStatus::class);
    }


OrderStatus.php

 public function order()
    {
        return $this->hasMany(Order::class);
    }
OrderStatus.php

 public function order()
    {
        return $this->hasMany(Order::class);
    }


I created an OrderStatusRelationManager in OrderResource and registered it in getRelations.
I want to be able to change the order status.

In my the table function I have the following

->headerActions([
              Tables\Actions\AssociateAction::make()->preloadRecordSelect(),
])
->headerActions([
              Tables\Actions\AssociateAction::make()->preloadRecordSelect(),
])

I'm getting the following error:
Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::associate()
Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::associate()

I also tried AttachAction in case I misunderstood which one I should use and I got
Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsTo::getRelatedKeyName()
Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsTo::getRelatedKeyName()


I also defined the inverse relation in my relation manager.
    protected static ?string $inverseRelationship = 'orders';
    protected static ?string $inverseRelationship = 'orders';


What am I missing ?
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

Associate BelongsTo relationship
FilamentFFilament / ❓┊help
3y ago
Relationship Manager for BelongsTo and HasMany Relationship
FilamentFFilament / ❓┊help
2y ago
Why can't I attach record to HasMany - BelongsTo relationship through relation manager?
FilamentFFilament / ❓┊help
2y ago
HasMany relationship
FilamentFFilament / ❓┊help
3y ago