Encore\Admin\Grid\Column::sorter PHP Method

sorter() public method

Create the column sorter.
public sorter ( ) : string | void
return string | void
    public function sorter()
    {
        if (!$this->sortable) {
            return;
        }
        $icon = 'fa-sort';
        $type = 'desc';
        if ($this->isSorted()) {
            $type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
            $icon .= "-amount-{$this->sort['type']}";
        }
        $query = app('request')->all();
        $query = array_merge($query, ['_sort' => ['column' => $this->name, 'type' => $type]]);
        $url = Url::current() . '?' . http_build_query($query);
        return "<a class=\"fa fa-fw {$icon}\" href=\"{$url}\"></a>";
    }