Skip to content

Commit

Permalink
added all param to conversation->makeChatEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
myckhel committed Jun 28, 2021
1 parent 29ffcfa commit 8dc22ad
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Models/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ function scopeWhereHasLastMessage($q, $user = null) {
);
}

function makeDelete($user = null) {
return $this->makeChatEvent($user);
function makeDelete($user = null, $row = false, $all = false) {
return $this->makeChatEvent($user, 'delete', $row, $all);
}
function makeRead($user = null) {
return $this->makeChatEvent($user, 'read', true);
function makeRead($user = null, $row = true, $all = false) {
return $this->makeChatEvent($user, 'read', $row, $all);
}
function makeDelivery($user = null) {
return $this->makeChatEvent($user, 'deliver', true);
function makeDelivery($user = null, $row = true, $all = false) {
return $this->makeChatEvent($user, 'deliver', $row, $all);
}

private function makeChatEvent($user, $type = 'delete', $row = false) {
private function makeChatEvent($user, $type = 'delete', $row = false, $all = false) {
$create = [
'made_id' => $this->id,
'made_type' => $this::class,
'type' => $type,
'all' => $all,
];

return $row
Expand Down

0 comments on commit 8dc22ad

Please sign in to comment.