Skip to content

Commit 9376f6f

Browse files
committed
fix issue of not cleare table of order column
1 parent 4766396 commit 9376f6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Ushahidi/Modules/V5/Repository/Post/EloquentPostRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,13 @@ public function paginate(
340340
array $with = []
341341
): LengthAwarePaginator {
342342
$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+
}
343347
$query = Post::take($paging->getLimit())
344348
//->skip($paging->getSkip())
345-
->orderBy($paging->getOrderBy(), $paging->getOrder());
349+
->orderBy('posts.'.$paging->getOrderBy(), $paging->getOrder());
346350

347351
$query = $this->setSearchCondition($search_fields, $query);
348352
$query = $this->setGuestConditions($query);

0 commit comments

Comments
 (0)