# Which is the best entrance for a prizing discourse? When reply to a topic, will win a prize by chance, to attract more people to take part in

**URL:** <https://discourse.laminas.dev/t/which-is-the-best-entrance-for-a-prizing-discourse-when-reply-to-a-topic-will-win-a-prize-by-chance-to-attract-more-people-to-take-part-in/2424>\
**Category:** Components & MVC\
**Tags:** laminas-mvc\
**Created:** [August 3, 2021, 3:44am UTC](https://discourse.laminas.dev/t/which-is-the-best-entrance-for-a-prizing-discourse-when-reply-to-a-topic-will-win-a-prize-by-chance-to-attract-more-people-to-take-part-in/2424 "2021-08-03T03:44:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jobsfan](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/jobsfan/32/399_2.png) [@jobsfan](https://discourse.laminas.dev/u/jobsfan)\
**Post date:** [September 24, 2021, 7:54am UTC](https://discourse.laminas.dev/t/which-is-the-best-entrance-for-a-prizing-discourse-when-reply-to-a-topic-will-win-a-prize-by-chance-to-attract-more-people-to-take-part-in/2424/4 "2021-09-24T07:54:07Z")

</div>

Hi, long time no see!

I learned the link you pasted above. And learned that event may be the best way to approach the goal.

And also I have read [Using the EventManager - tutorials - Laminas Docs](https://docs.laminas.dev/tutorials/event-manager/) several times.

Still I have problems to practise in my project.

1. I don’t know where to place the following code, in the Module.php?(I only found **attach** method in the **onBootstrap()** of **Module.php** file)

```auto
$events->attach('do', function ($e) {});

```

1. the PM said that, we may hold different activities(promotions) onside a topic. I am planning to write different classes for different promotion logics. each class encapsulate a concrete promotion logic. this way will provide flexibility to me. I can write anything inside the class.  
My question is that how to involve the promotion class(as well as promotion class instance) in/with the event stuff?

2. how to trigger the event after comment done. in another saying, where to place the trigger related code

```auto
$events->trigger('do', null, $params);

```

should I put it inside the CommentTable’s save() method?

> [@Passing config into model](https://discourse.laminas.dev/t/passing-config-into-model/2423/5):
>
> The whole system is a bit like a cross between a discussion forum and a mailing list. The Email\Model\EmailModel is a big long object that handles all email interactions. For example, when a new comment is made using CommentController it uses EmailModel to send the administrator a notification email. EmailModel is used from quite a few different Controllers to also handle sending out a bulk daily update email to subscribers. There isn’t much of an EmailController used. the Email module stores a…

You said it should decoupled with controller and action. inside the comment model you suggested. But I don’t know how. I am still looking forward to your example.

---

_[View the full topic](https://discourse.laminas.dev/t/which-is-the-best-entrance-for-a-prizing-discourse-when-reply-to-a-topic-will-win-a-prize-by-chance-to-attract-more-people-to-take-part-in/2424)._
