There's a "magic" loop structure called forelse. Here's how it works.
Instead of:
@if ($users->count())
  @foreach ($users as $user)
    This is user {{ $user->id }}
  @endforeach
@else
  No users found.
@endif
You can use this:
@forelse ($users as $user)
    This is user {{ $user->id }}
@empty
    No users found.
@endforelse
Nice, isn't it?
                                                
                                                    
                                                    
                                                    
No comments or questions yet...