@php // * Route vars $routeName = request()->route()?->getName() ?? 'noroute'; // * Default sort vars $defaultSortCol = $defaultSortCol ?? 'order'; $defaultSortWay = $defaultSortWay ?? 'asc'; $defaultSortWayStr = $defaultSortWay instanceof \SortDirection ? ($defaultSortWay === \SortDirection::Descending ? 'desc' : 'asc') : (string) $defaultSortWay; // * Request vars $currentSortCol = session()->get("{$routeName}.sort_col", $defaultSortCol); $currentSortWay = session()->get("{$routeName}.sort_way", $defaultSortWayStr); $searchQuery = request()->input('search'); // * Vue vars $noOrder = $noOrder ?? false; $ignore = isset($ignore) && is_array($ignore) ? $ignore : []; // * Hide order column $sortColIsOrder = $currentSortCol === 'order'; $noOrder = $noOrder || (!$sortColIsOrder && $currentSortCol) || !empty($searchQuery); View::share('noOrder', $noOrder); // * Reset button $hasCustomSort = ($currentSortCol && $currentSortCol !== $defaultSortCol) || ($currentSortCol === $defaultSortCol && $currentSortWay !== $defaultSortWayStr); $showReset = !empty($searchQuery) || $hasCustomSort; @endphp