All good.
You have a table with recipes and table with users and the table "favourites" - which is the user id and the id of the recipe.
On the main page displays the actual recipes
in the template of the index page
@foreach ($recipeCards as $recipeCard)
@include('template.recipePreview')
@endforeach
and plug-in the template of the recipe is this check
@if (Auth::check())
<?php $count = Favorite::where('dishId', '=', $recipeCard--->id)->where('id', '=', Auth::user()->id)->count(); ?>
@if ($count <> 0)
<li class="favorite black"></li>
@else
<li class="note gray"></li>
@endif
@endif
ie if the recipe in the user's favorites is the black icon, if not, grey.
Why is $count == 1 only under the condition that the first output recipe to favorites, and only for him.
In other cases, $count == 0. Why - to understand so far and failed.