model.relation.afterAssociate

Called after associating a relation to the model (only for BelongsTo/MorphTo relations)

Example usage:

$model->bindEvent('model.relation.afterAssociate', function (string $relationName, \Winter\Storm\Database\Model $relatedModel) use (\Winter\Storm\Database\Model $model) { $relatedClass = get_class($relatedModel); $modelClass = get_class($model); traceLog("{$relatedClass} was associated as {$relationName} to {$modelClass}."); });

Usage

Triggers

Copyright © 2024 Winter CMS