technodiva's avatar

Post location - Voting system

Hello, I'm working on this app for users who can upload images, and users to vote on them.

I've done the part about creating content and showing it, now I'm at the stage to build the voting system.

Request:

Post has 2 buttons: Black vote & White vote

Press button: • +1 added in db • one time per user • one button or the other, not both • user can unvote

Post can be either in Black div or White div, but not both.

The div is determined by Black votes and White votes: if Black votes > White votes div = Black ; else White

Obviously I'm not asking the code for this, but can you guide me with the steps, what to use to get there?

thanks!

0 likes
1 reply
aurawindsurfing's avatar

It depends if you want to reload page after clicking vote or not.

  1. If you reload page then simply direct to route that will increment the vote.

  2. If you do not reload it the you need to use na ajax call to your route and possibly vue to change the vote button properties.

Those will be 2 simple ways of doing it.

Please or to participate in this conversation.