Like 4-5 minutes ago I was lookin at this post Best Way To Build A Multi-Notification System in PHP and I was playing around with it to see how it would work in my website. so far it would work great although I wanted to know how to get the id to link back to where to notification took place at. For example say i leave a comment on user 1's photo and when user 1 looks in notification it shows i commented on one of his photo but how would he know which one exactly. Now I would foreign key and add another column but i would have to do this for every other type of notification "tagging, in a photo","liking a photo", "comment in profile", "sending a message", etc... unless i have to.
            Asked
            
        
        
            Active
            
        
            Viewed 100 times
        
    1 Answers
0
            
            
        Maybe it is best was to add Notifications model that would have fileds like this
object_type
object_id
user_id
object_type would be reference to type of what user commented (post,photo,etc..) it can be string...
Hope it helps...
        user12733
        
- 153
 - 1
 - 1
 - 11
 
- 
                    stackoverflow.com/questions/4721435/… I Was thinkking of combining this link with the one on this post and now that ive been thinkking i wouldnt have to foreign key `object id` would i ? – ThinkkSo Oct 29 '13 at 07:34
 - 
                    I think this is most simple way to accomplish this, and i can't see why you want to avoid foreign key `object id`. Of course there is million possible (more complicated) ways to do this, but only if you'r building next youtube site with million users :) [KISS](http://en.wikipedia.org/wiki/KISS_principle) – user12733 Oct 29 '13 at 07:55
 - 
                    Yeah But what Would I Relate Object ids foreign key to if there are defferent objects for example photos is 1 object and say status comments is another – ThinkkSo Oct 29 '13 at 08:16