<?php

namespace App\Http\Controllers\Sip_trunk;
use App\Http\Controllers\Controller;

use App\Helper\Helper;
use Illuminate\Support\MessageBag;
use Session;
use Illuminate\Http\Request;
use App\Http\Controllers\InheritApiController;
use Carbon\Carbon;
class TrunkingBalanceController extends Controller
{
    public function getBalance()
    {
        $balance=[];
        $url = env('API_URL') . 'trunking/balance';
        
        $response = Helper::GetApi($url);
        //echo "<pre>";print_r($response);die;
        try {
            if ($response && !empty($response->data)) {
                $balance=  $response->data;

            } else {
              
                session()->flash('error', 'No data available for the balance.');
            }
            
        } catch (Exception $e) {
            return response()->json("Something went wrong!!", 500);
        }
        
            return view("sip-trunk.balance",compact('balance'));
    }
 
}
