What's the Difference Between foreach and forelse in Laravel?

I’m familiar with the foreach loop in PHP and I also know how to use it in Laravel Blade templates. But I’ve noticed the @forelse thing in Laravel Blade templates. How is it different from foreach ? Can someone explain with easy examples, especially in the context of Laravel’s Blade templating system?

The main difference between @foreach and @forelse is how they handle empty arrays.

It just loops through the array. If the array is empty, it does nothing.

It also loops through the array, but if it’s empty, it allows to do something, like showing a message.

@forelse ($items as $item)
    <p>{{ $item }}</p>
    <p>No items found!</p>

So, if you want to do something specific when the array is empty, you’d use @forelse. Otherwise, you’d use @foreach for regular looping.