blade forelse code example
Example 1: forelse laravel
@forelse ($users as $user)
{{ $user->name }}
@empty
No users
@endforelse
Example 2: forelse blade
public function index()
{
$products = Product::get();
return view('home',compact('products'));
}
Laravel Check Array Empty in Blade
@forelse ($products as $product)
product
@empty
No product
@endforelse