We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4766396 commit 9376f6fCopy full SHA for 9376f6f
src/Ushahidi/Modules/V5/Repository/Post/EloquentPostRepository.php
@@ -340,9 +340,13 @@ public function paginate(
340
array $with = []
341
): LengthAwarePaginator {
342
$fields = $this->addPostsTableNamePrefix($fields);
343
+ // add the order field if not found
344
+ if (!in_array('posts.'.$paging->getOrderBy(), $fields)) {
345
+ $fields[] = 'posts.'.$paging->getOrderBy();
346
+ }
347
$query = Post::take($paging->getLimit())
348
//->skip($paging->getSkip())
- ->orderBy($paging->getOrderBy(), $paging->getOrder());
349
+ ->orderBy('posts.'.$paging->getOrderBy(), $paging->getOrder());
350
351
$query = $this->setSearchCondition($search_fields, $query);
352
$query = $this->setGuestConditions($query);
0 commit comments