ExpressionEngine® User Guide

Working with Relationships

Setting Relationships

To set a relationship, simply assign the model or collection that you want to relate, and then save() to commit the change:

$member->MemberGroup = ee('Model')->get('MemberGroup', 1)->first();
$member->save();