{{-- Left side: Table label --}}
@php // Get the table HTML $tableHtml = $dataTable->table(compact('id', 'class')); // Convert HtmlString to string $tableHtmlString = $tableHtml->__toString(); // Extract table id preg_match('/id="([^"]+)"/', $tableHtmlString, $matches); $tableId = $matches[1] ?? ''; @endphp {{-- Conditional label --}} @if(str_contains($tableId, 'recent-orders')) @elseif(str_contains($tableId, 'trending-products')) @elseif(str_contains($tableId, 'top-selling')) @else @endif
{{-- Right side: Search input --}}
{!! $tableHtml !!}
@push('footer') {!! $dataTable->scripts() !!} @endpush