Home:ALL Converter>nested foreach loop in laravel blade

nested foreach loop in laravel blade

Ask Time:2018-12-19T16:18:15         Author:amiralii

Json Formatter

I have nested foreach in my blade in laravel but all records compact twice in my select option here is my code:

@foreach($user as $user)
    @foreach($user_renter as $last_user_renter)
        @if($user->id == $last_user_renter->user_id)
           <option value="{{ $user->id }}" selected>
              {{ $user->name }} {{ $user->family }} - {{ $user->email }}
           </option>
        @else
           <option value="{{ $user->id }}">
              {{ $user->name }} {{ $user->family }} - {{ $user->email }}
           </option>
        @endif
    @endforeach
@endforeach

now is there any way to compact them once?

Author:amiralii,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/53847102/nested-foreach-loop-in-laravel-blade
yy