title: Laravel 5.4 blade foreach loop
body: <p>I am building a venue manangement system, and on the landing page, i m trying to show all the available slots to the visitors. The ones that have already been booked are shown as not available. I have created two variables, one that carries the info from the time table and the other from the booking table and tyring to use blade to compare and show.
  This is how I am trying to implement it in blade:</p>
  
  <pre><code>@foreach($times as $time)   
   @foreach($bookings as $booking)
      &lt;tr&gt;
          @if($time-&gt;availble_times == $booking-&gt;booking_time)
              &lt;td&gt;{{$time-&gt;availble_times}}: not available&lt;/td&gt;
          @else
              &lt;tr&gt;&lt;td&gt;{{$time-&gt;availble_times}}&lt;/td&gt;
          @endif
              &lt;/tr&gt;
   @endforeach    
  @endforeach 
  </code></pre>
  
  <p>But what this does instead is show all the times for as many records in the bookings table. Like if there are two rows in the bookings table, it shows the times twice, and so on. Just in case, here is my controller function:</p>
  
  <pre><code> public function times(){
      $times = Times::all();
      $bookings = Bookings::all();
      return view('/test2')-&gt;with('times', $times)-&gt;with('bookings', $bookings);
  }
  </code></pre>
  
  <p>I recently started doing Laravel and cannot figure out this issue. My question is, how can i fix the n-times display issue and show the user which times are booked and which are available?</p>