@php $currentSortField = request('sortField'); $currentSortDirection = request('sortDirection'); $moduleName = $title; @endphp

{{ $title ?? 'Records' }}

@foreach ($columns as $col) @php $currentSortField = request('sortField') ?? 'id'; $currentSortDirection = request('sortDirection') ?? 'desc'; @endphp @endforeach
{{ $col['label'] }} @if($col['sortable']) @php $iconClass = 'fas fa-sort'; if($currentSortField === $col['field'] && $currentSortDirection === 'asc') { $iconClass = 'fas fa-sort-up'; } elseif($currentSortField === $col['field'] && $currentSortDirection === 'desc') { $iconClass = 'fas fa-sort-down'; } @endphp @endif