Skip to content

Commit a17b5ad

Browse files
Added searching by UID (Webklex#161)
* Added `UID` as available criteria. * Added methods to simplify searching by UID.
1 parent 47d03dd commit a17b5ad

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/Query/WhereQuery.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class WhereQuery extends Query {
6262
'OR', 'AND',
6363
'ALL', 'ANSWERED', 'BCC', 'BEFORE', 'BODY', 'CC', 'DELETED', 'FLAGGED', 'FROM', 'KEYWORD',
6464
'NEW', 'NOT', 'OLD', 'ON', 'RECENT', 'SEEN', 'SINCE', 'SUBJECT', 'TEXT', 'TO',
65-
'UNANSWERED', 'UNDELETED', 'UNFLAGGED', 'UNKEYWORD', 'UNSEEN'
65+
'UNANSWERED', 'UNDELETED', 'UNFLAGGED', 'UNKEYWORD', 'UNSEEN', 'UID'
6666
];
6767

6868
/**
@@ -460,6 +460,33 @@ public function whereLanguage($country_code) {
460460
return $this->where("Content-Language $country_code");
461461
}
462462

463+
/**
464+
* Get message be it UID.
465+
*
466+
* @param int|string $uid
467+
*
468+
* @return WhereQuery
469+
* @throws InvalidWhereQueryCriteriaException
470+
*/
471+
public function whereUid($uid)
472+
{
473+
return $this->where('UID', $uid);
474+
}
475+
476+
/**
477+
* Get messages by their UIDs.
478+
*
479+
* @param array<int, int> $uids
480+
*
481+
* @return WhereQuery
482+
* @throws InvalidWhereQueryCriteriaException
483+
*/
484+
public function whereUidIn($uids)
485+
{
486+
$uids = implode(',', $uids);
487+
return $this->where('UID', $uids);
488+
}
489+
463490
/**
464491
* Apply the callback if the given "value" is truthy.
465492
* copied from @url https://github.com/laravel/framework/blob/8.x/src/Illuminate/Support/Traits/Conditionable.php

0 commit comments

Comments
 (0)