Back

Hey Laravel Developers

You must be aware of the Prunable trait that comes with Laravel.

This trait allows us to configure periodic deletions of unnecessary models from our table.

But did you know that you can add a pruning() method to your model class, which is automatically triggered when the model is deleted during the pruning process?

This can be useful when you need to perform additional operations along with the deletion.

For example, you might want to make an API call to a third-party service to delete the resource there as well.

image

46

0 / 1000