model.beforeGetAttribute

Called before the model attribute is retrieved (only when the attribute exists in $model->attributes or has a get mutator method defined; i.e. getFooAttribute())

Note: also triggered in Winter\Storm\Halcyon\Model

Example usage:

$model->bindEvent('model.beforeGetAttribute', function ((string) $key) use (\Winter\Storm\Database\Model $model) { if ($key === 'not-for-you-to-look-at') { return 'you are not allowed here'; } });

Usage

Triggers

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