DEV Community

Robert Look
Robert Look

Posted on

Laravel 8 - How To Check Array Is Empty Or Not In Laravel Blade?

let's follow this example to laravel check array empty in blade file with laravel 8 projects.

I simply read the documentation and I know the core PHP function so we can do it basically four-way to laravel check array not empty in laravel. so you can see below all examples one by one and you can use anyone that you want to use.

Laravel 8 - How To Check Array Is Empty Or Not In Laravel Blade?

<div class="card-header">
    <h5>How To Check Array Is Empty Or Not In Laravel Blade? - phpcodingstuff.com</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>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)