syncWithPivotValues method

Future<OrmMigrationRecord> syncWithPivotValues(
  1. String relationName,
  2. List ids,
  3. Map<String, dynamic> pivotData
)
inherited

Syncs a manyToMany relationship with the same pivot data for all records.

This is like sync but applies the same pivot data to all attached records.

Example:

final post = await Post.query().find(1);
await post.syncWithPivotValues('tags', [1, 2, 3], {'active': true});
// All pivot records now have active=true

Implementation

Future<TModel> syncWithPivotValues(
  String relationName,
  List<dynamic> ids,
  Map<String, dynamic> pivotData,
) async {
  return sync(relationName, ids, pivotData: pivotData);
}