681 B
681 B
Updating Resources
You can allow resources to be updated using the updatable and notUpdatable methods on the schema builder.
Optionally pass a closure that returns a boolean value.
$type->updatable();
$type->updatable(function (Context $context) {
return $context->getRequest()->getAttribute('user')->isAdmin();
});
Events
onUpdating
Run before the model is saved.
$type->onUpdating(function (&$model, Context $context) {
// do something
});
onUpdated
Run after the model is saved.
$type->onUpdated(function (&$model, Context $context) {
// do something
});