1@forelse($status->replies as $reply)
2 <p>{{ $reply->body }}</p>
3@empty
4 <p>No replies</p>
5@endforelse
6
7Check the documentation for the best result:
8http://laravel.com/docs/5.1/blade#control-structures
1public function index()
2
3{
4
5 $products = Product::get();
6
7 return view('home',compact('products'));
8
9}
10
11<div class="card-header">
12
13 <h5>Laravel Check Array Empty in Blade </h5>
14
15</div>
16
17<div class="card-body">
18
19 @forelse ($products as $product)
20
21 <p class="bg-danger text-white p-1">product</p>
22
23 @empty
24
25 <p class="bg-danger text-white p-1">No product</p>
26
27 @endforelse
28
29</div>
30