Laravel Blade Foreach If Empty or Not
public function index()
{
$products = Product::get();
return view('home',compact('products'));
}
<div class="card-header">
<h5>Laravel Check Array Empty in Blade </h5>
</div>
<div class="card-body">
@forelse ($products as $product)
<p class="bg-danger text-white p-1">product</p>
@empty
<p class="bg-danger text-white p-1">No product</p>
@endforelse
</div>
Also in PHP:
- composer global require laravel/
- 500 server error laravel handle
- associative array rev in php
- android studio clear cache
- database seeding
- error reporting php
- ext-dom install php 7.4
- create php laravel project
- date() options php
- client_ip() function php
- creat quik laravel app
- cron job for backup in laravel 5.4
- datae php
- check array has key php
- convert timestamp php
- check where key in associative array have a value
- Your Composer dependencies require the following PHP extensions to be installed: dom, mbstring, xml, xmlwriter
- diplay php error
- Difference between echo and print statement in php
- codeigniter 4 database seed multiple
- curl multi exec
- clear cache locally laravel
- encontrar un caracter en un strin php
- class 'illuminate support facades input' not found laravel 7