How to get team_id when creating new record from Relation Manager
I have a Relation Manager
ConversionsRelationManager
I'm trying to create new record from there but I keep getting team_id
doesn't have a default value. I have the normal resource UnitConversionResource
and I'm able to create new records there with the team_id
being passed correctlySolution:Jump to solution
Thanks @tomc actually found probaly a safer way since Users can edit values in hidden fields
```
->headerActions([
Tables\Actions\CreateAction::make()->mutateFormDataUsing(function (array $data): array {...
2 Replies
you can use the "hidden" component and pass the "team_id" (in your ConversionsRelationManager ) that worked for me,
below is my "PriceRelationManager.php" for my "CourseResource";
Do make sure to call your relations in the getRelations function within your MainResource, just my thoughts
Solution
Thanks @tomc actually found probaly a safer way since Users can edit values in hidden fields
As mention in the docs - https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create#customizing-data-before-saving