HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/posscale/www/printmanager/vendor/filament/tables/src/Columns/Concerns/CanBeSortable.php
<?php

namespace Filament\Tables\Columns\Concerns;

use Closure;

trait CanBeSortable
{
    protected bool | Closure $isSortable = false;

    /**
     * @var array<string> | null
     */
    protected ?array $sortColumns = [];

    protected ?Closure $sortQuery = null;

    /**
     * @param  bool | array<string> | Closure  $condition
     */
    public function sortable(bool | array | Closure $condition = true, ?Closure $query = null): static
    {
        if (is_array($condition)) {
            $this->isSortable = true;
            $this->sortColumns = $condition;
        } else {
            $this->isSortable = $condition;
            $this->sortColumns = null;
        }

        $this->sortQuery = $query;

        return $this;
    }

    /**
     * @return array<string>
     */
    public function getSortColumns(): array
    {
        return $this->sortColumns ?? $this->getDefaultSortColumns();
    }

    public function isSortable(): bool
    {
        return (bool) $this->evaluate($this->isSortable);
    }

    /**
     * @return array{0: string}
     */
    public function getDefaultSortColumns(): array
    {
        return [str($this->getName())->afterLast('.')];
    }
}