Open tkaravou opened 3 years ago
Can you provide why it would be a benefit over the existing conditionals available in the framework? Your suggested implementation could cause unexpected bugs in applications with early returns.
@if (! $records)
<h3>Record Listing</h3>
<ul>
@foreach($records as $record)
<li>{{ $record->name}}</li>
@endforeach
</ul>
@endif
Alternatively:
<h3>Record Listing</h3>
<ul>
@forelse($records as $record)
<li>{{ $record->name}}</li>
@empty
<li>No records.</li>
@endforelse
</ul>
In many cases, we have Blade partials that are wrapped up in an if statement to conditionally render them. It would be nice having something like @returnif where we exit the partial right away if the criteria is met
Usage