79250539

Date: 2024-12-04 09:35:11
Score: 3
Natty:
Report link

I have got this, to check, if you have voted or not

$post->voters->find(auth()->id())->exists(); //will return true or false

Now, if you are more willingly looking for is it up or down vote

$post->voters()->where('user_id', auth()->id())->where('type', 'up')->exists();

$post->voters()->where('user_id', auth()->id())->where('type', 'down')->exists();
Reasons:
  • RegEx Blacklisted phrase (2): down vote
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Sadan Khan