how to fill data with RelationManager Associate
i have 2 models: Group and Unit.
Group.php
public function units(): HasMany
{
return $this->hasMany(Unit::class);
}
Unit.php
public function group(): BelongsTo
{
return $this->belongsTo(Group::class);
}
i created an UnitsRelationManager in GroupRessource and registered it getRalations.
and i have this in my table function
->headerActions([
Tables\Actions\AssociateAction::make()->preloadRecordSelect(),
])
i'm getting this error when i try to associate a record
1 Reply
I just got the same error. For anyone else who also encounter similar issue you can get it to work by assigning inverseRelationship like for the given example we will write
protected static ?string $inverseRelationship = 'group';
in UnitsRelationManager