mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Various messy code.
This commit is contained in:
@@ -28,8 +28,11 @@ use LaravelJsonApi\Core\Query\SortFields;
|
||||
|
||||
trait SortsCollection
|
||||
{
|
||||
protected function sortCollection(Collection $collection, SortFields $sortFields): Collection {
|
||||
protected function sortCollection(Collection $collection, ?SortFields $sortFields): Collection {
|
||||
|
||||
if(null === $sortFields) {
|
||||
return $collection;
|
||||
}
|
||||
foreach($sortFields->all() as $sortField) {
|
||||
$collection = $sortField->isAscending() ? $collection->sortBy($sortField->name()) : $collection->sortByDesc($sortField->name());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user