Skip to content

Commit

Permalink
Pass sorting options through to getConversationsList musonza#301
Browse files Browse the repository at this point in the history
  • Loading branch information
Saifallak committed May 26, 2024
1 parent 3197616 commit ec8a4d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Models/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ private function getConversationsList(Model $participant, $options)
}

return $paginator
->orderBy('c.updated_at', 'DESC')
->orderBy('c.id', 'DESC')
->orderBy('c.updated_at', $options['sorting'] ?? 'DESC')
->orderBy('c.id', $options['sorting'] ?? 'DESC')
->distinct('c.id')
->paginate($options['perPage'], [$this->tablePrefix.'participation.*', 'c.*'], $options['pageName'], $options['page']);
}
Expand Down
1 change: 1 addition & 0 deletions src/Services/ConversationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function get()
'page' => $this->page,
'pageName' => 'page',
'filters' => $this->filters,
'sorting' => $this->sorting,
]);
}

Expand Down

0 comments on commit ec8a4d3

Please sign in to comment.