Level 2
Ok what ended up working is to apply an if condition within the for loop to check if something like:
$Employee->id==$bookingRequests->first()->employee_id
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have seen this question asked a few times and in each case its not clear what the solution is.
I need to loop through 2 collections one contains employees info the other contains bookings of these employees
If something like this were possible
@foreach($Employees as $Employee, $bookings as $booking)
// return something
@endforeach
Im reluctant to use a nested for loop if a nested for loop will mean the operation will first loop through the inner loop till done and repeats each time the outer loop increments
Please or to participate in this conversation.