1

I have a database tables as followed

Posts Table Comments Table Users Table Pages Table Likables Table
id id id id id
user_id user_id name page_name liker_id
content comment email liker_type
created_at created_at likable_id
likable_type

likable_type column in Likables Table may be post or comment and liker_type column may be page or user.

I want to access the the collection of total likers as well as each Page or User from the Post or Comment models.

Similarly, I would like to get the collection of Posts or Comments that the User or Page liked.

Is it possible to have like this? How can I make the relationships for this scenario?

drhtoo
  • 11
  • 2
  • I think your question should be possible. What have you already tried (code) to get this working? – Techno Feb 18 '22 at 14:29

0 Answers0