File "OrganizationSort.php"

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

<?php

declare(strict_types=1);

namespace App\Domain\Payment\Sorting;

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

class OrganizationSort extends BasePaymentsSort
{
    public static function sort(Collection $data, bool $desc = false): Collection
    {
        return $data->sortBy(function ($item) {
            /** @var Payment $item */
            return mb_strtolower($item->organization->full_name);
        }, SORT_REGULAR, $desc)->values();
    }
}