© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
2 replies
bardolf_6969

How to change resource form opened by edit action on a relationmanager

This is going to get confusing but let me try. I have 2 models Degree and Programs, these share a many to many relationship that includes pivot table data. These tables are also accessed from a different (legacy) application so the pivot table needed to have it's own id field. So I made a model and resource in filament called DegreeProgram. I have setup the forms etc for DegreeProgram in filament but it looks ugly having it on the navigation menu.

Within the DegreeResource I have a relationmanager for programs and would like to have the create and edit actions from that relation manager redirected to the create and edit forms for the DegreeProgramResource instead, while leaving the attach/deteach actions link the the original relationship.

I tried editing the relationship manager to use the other form but that threw this error
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given.
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given.


So then I tried mutating the data being sent to the form like this

->mutateRecordDataUsing(fn (array $data): array => [
             $data = DegreeProgram::where('program_id', $data['program_id'])->where('degree_id', $data['degree_id'])->first(),
         ]),
->mutateRecordDataUsing(fn (array $data): array => [
             $data = DegreeProgram::where('program_id', $data['program_id'])->where('degree_id', $data['degree_id'])->first(),
         ]),

but that throws this error
Call to a member function getResults() on null
Call to a member function getResults() on null


Does anyone have any other ideas?
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

Edit resource in attach action form?
FilamentFFilament / ❓┊help
2y ago
Custom action on edit resource
FilamentFFilament / ❓┊help
3y ago
How to get the form data in a RelationManager create or edit action?
FilamentFFilament / ❓┊help
10mo ago
How to place Action Button on Resource Form by the Delete Button?
FilamentFFilament / ❓┊help
3y ago