I'm making posts for my website and now I want people able to like the post. But when they like the post (if there are 0 likes) you see one empty heart. But when multiple people likes the post there will be more hearts.
Here is my code
@foreach($post->likes as $likes)
@if($likes->where('user_id', Auth::User()->id))
<i onclick="window.location.href = '/blog/like/{{ $post->id }}';"
class="fa fa-heart liked"></i>
@else
<i onclick="window.location.href = '/blog/like/{{ $post->id }}';"
class="far fa-heart"></i>
@endif
@endforeach
In the code above, you have a i class with 'liked' in it. I want one of that item on my blade and not multiple. Can somebody help me?
Must be one heart
