24 lines
579 B
PHP
24 lines
579 B
PHP
<?php
|
|
|
|
if (!function_exists('generateSortRouteParameter')) {
|
|
function generateSortRouteParameter(string $sortKey): array
|
|
{
|
|
|
|
return array_merge(request()->query(), ['sort' => $sortKey]);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('activeSort')) {
|
|
function activeSort(string $sortKey, string $default = ''): string
|
|
{
|
|
$currentSort = request()->query('sort', $default);
|
|
|
|
|
|
if ($currentSort === $sortKey) {
|
|
return 'bg-blue-500 text-white font-DanaMedium';
|
|
}
|
|
|
|
return 'text-gray-600 dark:text-gray-300 hover:text-blue-500';
|
|
}
|
|
}
|