foreach blade code example
Example 1: forach in larvel blade
@forelse ($array as $element)
// loop here
@empty
// is empty
@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