Skip to content

Commit

Permalink
changed conversation's notMsgEvents to doesntHaveChatEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
myckhel committed Sep 25, 2021
1 parent f8db80a commit baf8004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 91575f to 508fde
6 changes: 3 additions & 3 deletions src/Models/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,18 @@ public function messages(){
public function unread(int|ChatEventMaker $user = null){
$user_id = $user->id ?? $user ?? auth()->user()?->id;

return $this->notMsgEvents($user_id, 'read')->latest()
return $this->doesntHaveChatEvents($user_id, 'read')->latest()
->when($user_id, fn ($q) => $q->whereNotSender($user_id));
}

function undelivered(int|ChatEventMaker $user = null){
$user_id = $user->id ?? $user ?? auth()->user()?->id;

return $this->notMsgEvents($user_id, 'deliver')
return $this->doesntHaveChatEvents($user_id, 'deliver')
->where('user_id', '!=', $user_id);
}

function notMsgEvents(int|ChatEventMaker $user, $type = null) {
function doesntHaveChatEvents(int|ChatEventMaker $user, $type = null) {
$user_id = $user->id ?? $user;

return $this->messages()
Expand Down

0 comments on commit baf8004

Please sign in to comment.