public function showTransactionHistory() { $id = Session::get('ig_user')['id']; $modelTransactions = Transaction::getInstance(); $where = array('rawQuery' => 'user_id=?', 'bindParams' => [$id]); $selectedColumns = ['transactions.*', 'users.email']; $txDetails = $modelTransactions->getUserInfoByUserId($where, $selectedColumns); // echo'<pre>'; // print_r($txDetails);die; $trans = new Collection(); $txDetails = json_decode(json_encode($txDetails), true); foreach ($txDetails as $txd) { $trans->push(['tx_id' => $txd['tx_id'], 'date' => $this->convertUT($txd['payment_time']), 'amount' => $txd['amount'], 'email' => $txd['email'], 'transaction_id' => $txd['transaction_id'], 'status' => 'completed']); } return Datatables::of($trans)->make(true); }
public function paymentHistoryAjaxHandler() { $objModelTransaction = Transaction::getInstance(); $transactionDetails = $objModelTransaction->getAvaiableUsersDetails(); $paymentHistory = new Collection(); $transactionDetails = json_decode(json_encode($transactionDetails), true); foreach ($transactionDetails as $td) { $class = $td['tx_mode'] == 0 ? '<i class="fa fa-paypal" style="color: green"></i>' : '<i class="fa fa-credit-card" style="color: green"></i>'; $amount = $td['amount'] >= 100 ? '<i style="color: #880000">' . $td['amount'] . '</i>' : $td['amount']; $paymentHistory->push(['id' => $td['tx_id'], 'username' => $td['username'], 'email' => $td['email'], 'transcationId' => $td['transaction_id'], 'amount' => $amount, 'date' => $this->convertUnixTimeToReadableFormat($td['payment_time']), 'status' => 'completed', 'details' => $class]); } return datatables::of($paymentHistory)->make(true); }