From 28b1a49dec3aca0e8f2976635a16eec124018956 Mon Sep 17 00:00:00 2001 From: anazaryan Date: Tue, 10 Dec 2024 17:46:46 +0400 Subject: [PATCH] delete old messages --- app/Console/Commands/DeleteOldMessages.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); } }); -- 1.7.10.4