Filament Updating Non-Existent Relation Column - But why ?

What I am trying to do: I’m building a Filament admin form for editing a Studio record. In that form I have a Section with ->relationship('aidooData') so that nested fields correspond to a related StudioAidooData model. My filament version is 3.3.43. What I did: - In the migration for studio_aidoo_data I created a studio_id foreign ULID column (non-nullable) plus other fields. - I used Section::make('Aidoo')->relationship('aidooData')->schema([...]) in my Filament form. My issue / the error: I get this SQL error when saving: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'aidooData' in 'field list' … update studios set aidooData = … where id = …
It seems Filament is trying to update a column called aidooData on the studios table — which doesn’t exist. Even more confusing: in some cases, the aidooData relation does get updated (i.e. the child table) — so behavior is inconsistent. Code: Here are relevant snippets: Studio model: public function aidooData(): HasOne { return $this->hasOne(StudioAidooData::class,); } Migration for studio_aidoo_data: Schema::create('studio_aidoo_data', function (Blueprint $table) { $table->ulid('id')->primary(); $table->foreignUlid('studio_id')->references('id')->on('studios'); $table->string('appointment_type_id')->nullable(); $table->timestamps(); $table->softDeletes(); }); Filament form: FormSection::make('Aidoo') ->relationship('aidooData') ->schema([ TextInput::make('appointment_type_id'), ]) EditStudio workaround: protected function handleRecordUpdate(Model $record, array $data): Model { unset($data['aidooData']); return parent::handleRecordUpdate($record, $data); } What I need help diagnosing / fixing: Why is Filament (or Eloquent) trying to update studios.aidooData at all, given the relationship(...) setup? Thanks a lot — happy to provide more context if needed.
2 Replies
akahalls
akahalls2mo ago
$data['aidooData'] shoudn’t work
bookoly
bookolyOP2mo ago
With this workaround I'm able to edit the studio without errors. Any ideas ? 🙂

Did you find this page helpful?