File "AccountDebit1cSort.php"

Full Path: /var/www/html/back/app/Domain/Payment/Sorting/AccountDebit1cSort.php
File size: 523 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace App\Domain\Payment\Sorting;

use App\BaseClasses\BasePaymentsSort;
use Illuminate\Database\Eloquent\Collection;

class AccountDebit1cSort extends BasePaymentsSort
{
    public static function sort(Collection $data, bool $desc = false): Collection
    {
        $data = $data->sortBy(function ($item) {
            return mb_strtolower($item->account_debit_1c ?? '');
        });


        if ($desc) {
            $data = $data->reverse();
        }
        return $data;
    }
}