@forelse in laravel code example
Example 1: forelse laravel
@forelse ($users as $user)
<li>{{ $user->name }}</li>
@empty
<p>No users</p>
@endforelse
Example 2: foreach in laravel
foreach ($users as $user) {
// stuff here
}
@forelse ($users as $user)
<li>{{ $user->name }}</li>
@empty
<p>No users</p>
@endforelse
foreach ($users as $user) {
// stuff here
}