Skip to content

Commit ec8a4d3

Browse files
committed
Pass sorting options through to getConversationsList musonza#301
1 parent 3197616 commit ec8a4d3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Models/Conversation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ private function getConversationsList(Model $participant, $options)
373373
}
374374

375375
return $paginator
376-
->orderBy('c.updated_at', 'DESC')
377-
->orderBy('c.id', 'DESC')
376+
->orderBy('c.updated_at', $options['sorting'] ?? 'DESC')
377+
->orderBy('c.id', $options['sorting'] ?? 'DESC')
378378
->distinct('c.id')
379379
->paginate($options['perPage'], [$this->tablePrefix.'participation.*', 'c.*'], $options['pageName'], $options['page']);
380380
}

src/Services/ConversationService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function get()
110110
'page' => $this->page,
111111
'pageName' => 'page',
112112
'filters' => $this->filters,
113+
'sorting' => $this->sorting,
113114
]);
114115
}
115116

0 commit comments

Comments
 (0)