I
I
Ilya Parshakov2018-03-22 18:37:37
Laravel
Ilya Parshakov, 2018-03-22 18:37:37

How to properly organize events and listeners (event, listener)?

Hello.
For educational purposes, I decided to deal with the events and implement a small collection of information about the site visitor.
For example, a user visits a post page, likes it, views a product. I would like to save all this data separately, the number of visits to blog pages, product views, the number of likes, user ip, and so on.
The question arose whether it is necessary to create a separate event for counting visits, separately for counting likes ... or create one event and different listeners for it and call those listeners that are needed at a certain moment, in the controller or model?
How to implement this at all, how would you do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2018-03-22
@JhaoDa

0. Have you read the documentation? Apparently not.
1. Obviously, viewing a post, a product, or a like are three DIFFERENT events from the point of view of even banal logic.
2. Event listeners are not called by hand.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question