Terumi's avatar

Model Encapsulation

Hello,

I have a Post model which can have some "Events". The events are "status change", "new message", "owneship change", etc.

Now, in order to track all these "events" in a chronological order I created an "event_post" table in which I store this info:

id post_id event_type event_type_id timestamps

That way, when a new message or status change occurs, I can store in the "event_post" table that a given post has a new thing going on.

The problem is that I don't know how to implement the relationship:

A post has many events, but I don't have a Event Model, because an event might be either a new message, status_change, ownership_change etc.

Does anyone know how to solve this?

0 likes
1 reply

Please or to participate in this conversation.