Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
peripherad
/
back
/
app
/
Domain
/
Payment
/
Sorting
:
ArticleSort.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php declare(strict_types=1); namespace App\Domain\Payment\Sorting; use App\BaseClasses\BasePaymentsSort; use App\Models\Payment; use App\Models\PaymentDistribution; use Illuminate\Database\Eloquent\Collection; class ArticleSort extends BasePaymentsSort { public static function sort(Collection $data, bool $desc = false): Collection { $data = $data->sortBy(function ($item) { return mb_strtolower($item->distributions->first()?->article->name ?? ''); }); if ($desc) { $data = $data->reverse(); } return $data; } }