Laravel Blade - check if data array has specific key
You can use @isset
:
@isset($data['currentOffset'])
{{-- currentOffset exists --}}
@endisset
I think you need something like this:
@if ( isset($data[$currentOffset]) )
...
Use following:
@if (array_key_exists('currentOffset', $data))
<p>Current Offset: {{ $data['currentOffset'] }} </p>
@else
<p>The key `currentOffset` is not in the data array</p>
@endif