PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function getBalance() { $url = 'http://103.53.84.15:8746/api/v2/balance'; $data = [ 'apikey' => 'c867dc134e3aeba4', 'secretkey' => '2472b639', 'clienttransid' => 'DreamG.City' ]; $payload = json_encode($data); try { $ch = curl_init($url); if ($ch === false) { throw new Exception('Failed to initialize cURL.'); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); $response = curl_exec($ch); if ($response === false) { throw new Exception('cURL error: ' . curl_error($ch)); } $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode !== 200) { throw new Exception("HTTP error: Status code $httpCode"); } $decoded = json_decode($response, true); if (json_last_error() !== JSON_ERROR_NONE) { throw new Exception('JSON decode error: ' . json_last_error_msg()); } if (!isset($decoded['statusInfo']['availablebalance'])) { throw new Exception('Missing available balance in response.'); } return $decoded['statusInfo']['availablebalance']; } catch (Exception $e) { // You can log this error if needed return "SMS not Working"; } } public function index() { $total_member = Member::count(); $total_plot = Plot::count(); $total_sales = Sale::count(); $total_purchase = LandPurchase::count(); $total_reference = Reference::count(); $total_installment = installment::count(); $sms_single = SingleSmsList::sum('sms_count'); $sms_group = GroupMsg::sum('sms_count'); $sms_account= $this->getBalance(); //$sms_account = json_decode($sms_account, true); if (is_float($sms_account)) { $sms_account = round($sms_account, 2); } else { $sms_account = round($sms_account, 2); } $rest = 2500 - ($sms_single + $sms_group); //$sms_account = SmsBalance::where('id', 1)->first(); return view('home', compact('sms_single', 'sms_group', 'total_member', 'total_installment', 'total_plot', 'total_purchase', 'total_reference', 'total_sales', 'sms_account', 'rest')); } }