Filament 3 Fieldset relationship not storing

I have a couple form fields wrapped in a Filament Fieldset like so.
Fieldset::make('Recommendation')
->visibleOn('edit')
->visible(fn () => auth()->user()->hasAnyRole('super_admin', 'recommender'))
->disabled(function ($record) {
if(Some logic) {
return false;
}

return true;
})
->relationship('recommendation')
->schema(ApprovalStatusRelationManager::geRecommenderForm()),
Fieldset::make('Recommendation')
->visibleOn('edit')
->visible(fn () => auth()->user()->hasAnyRole('super_admin', 'recommender'))
->disabled(function ($record) {
if(Some logic) {
return false;
}

return true;
})
->relationship('recommendation')
->schema(ApprovalStatusRelationManager::geRecommenderForm()),
The relationship recommendation is defined like so:
public function recommendation(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Recommendation::class);
}
public function recommendation(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Recommendation::class);
}
When I try to save the parent form which has the Fieldset I get the below error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'recommendation' in 'field list'.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'recommendation' in 'field list'.
I believe the ->relationship('recommendation') is not called properly and it assumes that recommendation is a column on the parent model. How can I fix this?
1 Reply
Dennis Koch
Dennis Koch2mo ago
Are you using the standalone form builder or the panels?

Did you find this page helpful?