From 548d1040bb37464adbce6c0b7f1782671e315c17 Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Tue, 9 Sep 2025 15:48:19 +0500 Subject: [PATCH] wip --- app/Nova/Actions/Sber/SyncWithSystem.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/Nova/Actions/Sber/SyncWithSystem.php b/app/Nova/Actions/Sber/SyncWithSystem.php index 84cd980..6c65e88 100644 --- a/app/Nova/Actions/Sber/SyncWithSystem.php +++ b/app/Nova/Actions/Sber/SyncWithSystem.php @@ -60,7 +60,24 @@ class SyncWithSystem extends Action $systemResponse = json_decode($systemRawResponse); - $success = $systemResponse->errCode == 0; + info([ + 'type' => gettype($systemResponse), + 'response' => $systemResponse, + 'isClass' => is_object($systemResponse), + 'isArray' => is_array($systemResponse), + ]); + + if (is_object($systemResponse)) { + $success = $systemResponse->errCode == 0; + } else { + $success = $systemResponse['errCode'] == 0; + } + + if (is_array($systemResponse)) { + $success = $systemResponse['errCode'] == 0; + } else { + $success = $systemResponse->errCode == 0; + } if ($success) { $orderItem->update([ @@ -73,8 +90,8 @@ class SyncWithSystem extends Action } return Action::modal('modal-response', [ - 'html' => $success ? "Success" : "Fail", - 'title' => $success ? "Success" : "Fail", + // 'html' => $success ? "Success" : "Fail", + // 'title' => $success ? "Success" : "Fail", ]); }