Laravel Model Observer

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

744 total views, 4 views today