Skip to content

Commit 4e46be5

Browse files
Add states parameter to Conversation getThreads() function
1 parent 69c58b4 commit 4e46be5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/Conversation.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,17 @@ public function getReplies()
390390
*
391391
* @return Collection
392392
*/
393-
public function getThreads($skip = null, $take = null, $types = [])
393+
public function getThreads($skip = null, $take = null, $types = [], $states = [Thread::STATE_PUBLISHED])
394394
{
395395
$query = $this->threads()
396-
->where('state', Thread::STATE_PUBLISHED)
397396
->orderBy('created_at', 'desc');
398397

398+
if (count($states) == 1 && !empty($states[0])) {
399+
$query->where('state', $states[0]);
400+
} else {
401+
$query->whereIn('state', $states);
402+
}
403+
399404
if (!is_null($skip)) {
400405
$query->skip($skip);
401406
}

0 commit comments

Comments
 (0)