model.relation.beforeDissociate

Called before dissociating a relation to the model (only for BelongsTo/MorphTo relations)

Example usage:

$model->bindEvent('model.relation.beforeDissociate', function (string $relationName, Model $relatedModel) { if ($relationName === 'permanentRelation') { throw new \Exception("Cannot dissociate a permanent relation!"); } });

Usage

Triggers

Copyright © 2024 Winter CMS