1 month ago

What is the best way to manage an unregistered visitor rating system? Token? IP??

Posted 1 month ago by jefferyjames

Hi all, I want my website visitor to be able to tell me by two simple button if some post are 'Usefull' or 'Useless', like thumbs.

I know some packages could do this with some lines of code but I also want with this system to learn some relationship tricks.

Only my post will be "rateable", so I think I don't need a polymorphic structure.

What I have in mind:

Rate table with: a token cookie or an IP, or twice?? post_id rate (boolean: 1 = usefull, 0 = useless)

Rate model belongsTo Post Post model hasMany Rate

My question is: what is the best way to store "unique" visitor in my table? a token? the IP address of visitor? twice? something else? Maybe Laravel includes some magic tricks to catch "unique visitor which have already rate post"?

I welcome any advice which could help me.


Please sign in or create an account to participate in this conversation.