Commit 28b1a49dec3aca0e8f2976635a16eec124018956

Authored by Hayk Nazaryan
1 parent 2ea18676c7
Exists in master

delete old messages

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

app/Console/Commands/DeleteOldMessages.php
... ... @@ -33,11 +33,11 @@ class DeleteOldMessages extends Command
33 33 Message::query()->get()->map(function ($message) {
34 34 $chatFrom = Chat::query()->where(['id' => $message->chat_id_from])->first();
35 35 if (!$chatFrom) {
36   - $chatFrom->delete();
  36 + $message->delete();
37 37 }
38 38 $chatTo = Chat::query()->where(['id' => $message->chat_id_to])->first();
39 39 if (!$chatTo) {
40   - $chatTo->delete();
  40 + $message->delete();
41 41 }
42 42 });
43 43