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
Class or file | Line |
---|---|
Winter\Storm\Database\Relations\Concerns\BelongsOrMorphsTo
|
67 |
Copyright © 2024 Winter CMS