@props([ 'headers' => [], 'paginator' => null, 'emptyMessage' => 'No data found.', 'emptyActionText' => null, 'emptyActionUrl' => null, 'wrapperClass' => '', 'tableClass' => '', 'wrapperStyle' => null, 'tableStyle' => null, ]) @php /* Backward compatible behavior: - If paginator is passed: show table only when paginator has rows. - If paginator is NOT passed: always render table and let the parent slot handle @forelse/@empty. */ $hasPaginator = !is_null($paginator); $shouldRenderTable = !$hasPaginator || ($hasPaginator && $paginator->count()); @endphp
@if ($shouldRenderTable)
@foreach ($headers as $header) @endforeach {{ $slot }}
{{ $header }}
@if ($hasPaginator && method_exists($paginator, 'links'))
{{ $paginator->appends(request()->except('page'))->links('pagination::bootstrap-5') }}
@endif @else

{{ $emptyMessage }}

@if ($emptyActionText && $emptyActionUrl) {{ $emptyActionText }} @endif
@endif