671 B
671 B
Deleting Resources
You can allow resources to be deleted using the deletable and notDeletable methods on the schema builder.
Optionally pass a closure that returns a boolean value.
$type->deletable();
$type->deletable(function (Context $context) {
return $request->getAttribute('user')->isAdmin();
});
Events
onDeleting
Run before the model is deleted.
$type->onDeleting(function (&$model, Context $context) {
// do something
});
onDeleted
Run after the model is deleted.
$type->onDeleted(function (&$model, Context $context) {
// do something
});