diff --git a/app/Console/Commands/DeleteOldMessages.php b/app/Console/Commands/DeleteOldMessages.php index 9bd717d..6866d16 100644 --- a/app/Console/Commands/DeleteOldMessages.php +++ b/app/Console/Commands/DeleteOldMessages.php @@ -33,11 +33,11 @@ class DeleteOldMessages extends Command Message::query()->get()->map(function ($message) { $chatFrom = Chat::query()->where(['id' => $message->chat_id_from])->first(); if (!$chatFrom) { - $chatFrom->delete(); + $message->delete(); } $chatTo = Chat::query()->where(['id' => $message->chat_id_to])->first(); if (!$chatTo) { - $chatTo->delete(); + $message->delete(); } });