Models
Deleting Models
Deleting models with Vasta.
To delete a model from the database, call the delete method on a model instance. This will remove the record from the database.
const pet = await Pet.findOrFail(1);
await pet.delete();
Events
When you delete a model, Vasta dispatches two events:
deleting: Dispatched immediately before the record is deleted from the database.deleted: Dispatched immediately after the record is successfully deleted.
You can learn more about hooking into these events in the Events documentation.