@php $route = request()->route(); $routeName = $route->getName(); $rst = !is_null(request()->rst) || !Session::has("$routeName.sorted"); $noOrder = Session::get("$routeName.sort_col") !== 'order' and (Session::has("$routeName.sort_col") or Session::has("$routeName.sort_way")); @endphp @foreach($cols as $col => $colname) @php $iArgs = ['sort_col' => $col]; if(request()->search) { $iArgs['search'] = request()->search; } @endphp {{-- NO Sort for order column --}} @if($col === 'order' or in_array($col, $ignore)) @if($noOrder and !$rst and !in_array($col, $ignore)) @continue @endif {{ $colname }} @continue @endif {{ $colname }} @if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'desc' and session("$routeName.sort_col") === $col)) @endif @if(!session("$routeName.sort_way") or session("$routeName.sort_col") !== $col or (session("$routeName.sort_way") === 'asc' and session("$routeName.sort_col") === $col)) @endif @endforeach {{-- Buttons Col --}} @if($noOrder and !$rst) @else @endif