Repeater and many-to-many (belognsToMany, morphsToMany) not saving

I have this issue where repeater cant handle belongsToMany or morphToMany relations.
Having this structure with Product, Option and a pivot table ConnectedModel, and after a lot of debuging I think Filament does insert the rows in the pivot table but it deletes it for some reason when using ->saveRelationshipUsing() , because is trying to save it again for some reason and there is no way as I see to disabled the auto relation save and allow only the manual save to avoid this. Product class
Class Product extends Model{

public function options()
{
return $this->morphToMany(Option::class, 'target_model', 'connected_models', 'target_model_id', 'connected_model_id')
->using(ConnectedModel::class);
}
}
Class Product extends Model{

public function options()
{
return $this->morphToMany(Option::class, 'target_model', 'connected_models', 'target_model_id', 'connected_model_id')
->using(ConnectedModel::class);
}
}
Option class
class Option extends Model
{
public function products()
{
return $this->morphedByMany(Product::class, 'connected_model', 'connected_models', 'connected_model_id', 'target_model_id');
}
}
class Option extends Model
{
public function products()
{
return $this->morphedByMany(Product::class, 'connected_model', 'connected_models', 'connected_model_id', 'target_model_id');
}
}
ConnectedModel pivot class
class ConnectedModel extends MorphPivot
{

protected $table = 'connected_models';

protected $fillable = [
'target_model_id',
'target_model_type',
'connected_model_id',
'connected_model_type',
'position',
];
}
class ConnectedModel extends MorphPivot
{

protected $table = 'connected_models';

protected $fillable = [
'target_model_id',
'target_model_type',
'connected_model_id',
'connected_model_type',
'position',
];
}
Anyone have this problem and any idea how to handle this?
1 Reply
Dimitar Papazov DEV
up
Want results from more Discord servers?
Add your server