Answer the question
In order to leave comments, you need to log in
Why does validation in Laravel only happen the first time?
All the best.
There is a table with recipes, a table with users and a "favorite" table, which contains the user id and recipe id.
The main page displays the actual recipes themselves
in the index page template
@foreach ($recipeCards as $recipeCard)
@include('template.recipePreview')
@endforeach
@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="favorite gray"></li>
@endif
@endif
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question