Laravel Model Observer

Last Updated: November 6, 2019

What is Observer?

In Laravel, you can listen to events on a Model. For example, when you update the model product, it will fire the event updated.

You can listen to these events and write some code to executes when they fire.

There are several events like creating, updating, deleting etc.

So you can group these events of a model and make an Observer class. Methods in this Observer class has only one argument, which is the Model.

How to create Observer