Relation manager custom action + Spatie media library plugin

Hello everyone, i have a relation manager which has a custom action in its $table
  • ```phpAction::make('bom') ->model(Bom::class) ->label('Import Bom') ->form(Bom::getForm()) ->action(function ($record, array $data): void { Bom::updateOrCreate([ 'assembly_id' => $record->id, 'bom_name' => $data['bom_name'], 'header_row_in_excel' => $data['header_row_in_excel'], 'last_row_in_excel' => $data['last_row_in_excel'], ]); })```
ow, inside Bom::getForm() I have a media field using spatie's plugin which looks like this -

SpatieMediaLibraryFileUpload::make('bom_file')
                ->collection('bom_files')


For some reason, when i upload a file, it is being attached to the parent model (Assembly) rather than to Bom, even though im explicitly using ->model() and the ->form() method is referencing to Bom's model as well.. So why is it happening?
Was this page helpful?