Skip to content

Commit

Permalink
fix "mobile" source condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Mh-Asmi committed Mar 18, 2024
1 parent 5daeeef commit 5b947fd
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,17 @@ private function setSearchCondition(PostSearchFields $search_fields, $query, boo
$query->where(function ($builder) use ($search_fields) {
$builder->whereNull('messages.type')
->orWhereIn('messages.type', $search_fields->source());
if (in_array('mobile', $search_fields->source())) {
$builder->orWhere('posts.source', 'mobile');
}
});
} else {
$query->whereIn('messages.type', $search_fields->source());
}

// Check if $search_fields->source() contains 'mobile' and if so, add make a if else statement
if (in_array('mobile', $search_fields->source())) {
$query->orWhere('posts.source', 'mobile');
$query->where(function ($builder) use ($search_fields) {
$builder->WhereIn('messages.type', $search_fields->source());
if (in_array('mobile', $search_fields->source())) {
$builder->orWhere('posts.source', 'mobile');
}
});
}
}

Expand Down

0 comments on commit 5b947fd

Please sign in to comment.