Untitled
unknown
plain_text
6 months ago
1.2 kB
1
Indexable
public function deleteBackupRequestIfRequestExists(): void { $chunk_limit = 1500; $start_date = '2024-08-21'; try { $log_data['action'] = "DELETE_BACKUP_REQUEST_IF_REQUEST_EXISTS"; BackupRequest::query() ->where('created_at', '>=', $start_date) ->chunkById($chunk_limit, function ($backup_requests) use (&$log_data) { foreach ($backup_requests as $backup_request) { $requestObj = PurchaseRequest::query()->find($backup_request->id); if($requestObj) { $log_data['request_id'][] = $backup_request->id; $log_data['sale_id'][] = $backup_request->order_id; $backup_request->delete(); } } }); } catch (\Throwable $th) { $log_data['exception'][] = Exception::fullMessage($th); } (new ManageLogging())->createLog($log_data); }
Editor is loading...
Leave a Comment