model.beforeSave

Called before the model is saved

Note: This is called both when creating and updating and is also triggered in Winter\Storm\Halcyon\Model

Example usage:

$model->bindEvent('model.beforeSave', function () use (\Winter\Storm\Database\Model $model) { if (!$model->isValid()) { throw new \Exception("Invalid Model!"); } });

Usage

Triggers

Class or file Line
Winter\Storm\Database\Model 381
Copyright © 2024 Winter CMS