public function formDeposit($wallet_id = '') { $user = Confide::user(); $user_id = $user->id; $data = array(); if ($wallet_id == '') { $wallet = Wallet::first(); } else { $wallet = Wallet::find($wallet_id); } $balance = new Balance(); $order = new Order(); $market = new Market(); $data['page'] = 'deposit'; $data['current_coin'] = $wallet->type; //$wallet->getType($wallet_id); $data['name_coin'] = $wallet->name; $balance_amount = $balance->getBalance($wallet_id); $data['balance'] = sprintf('%.8f', $balance_amount); if ($wallet->is_moneypaper) { $data['method_deposits'] = MethodDepositCurrency::orderBy('dname')->get(); } elseif ($wallet->enable_deposit) { //echo "<pre>".dd(DB::getQueryLog())."</pre>"; $wallet->connectJsonRPCclient($wallet->wallet_username, $wallet->wallet_password, $wallet->wallet_ip, $wallet->port); //echo "Fee: ".$wallet->getTxFee(); //echo "<br>getDepositAddress: ".$wallet->getDepositAddress('test'); // echo "<br>getReceivedByAccount: ".$wallet->getReceivedByAccount(''); $addr_deposit = UserAddressDeposit::where('wallet_id', $wallet->id)->where('user_id', $user->id)->first(); $address = ''; if (!isset($addr_deposit->addr_deposit)) { try { $wallet->connectJsonRPCclient($wallet->wallet_username, $wallet->wallet_password, $wallet->wallet_ip, $wallet->port); $address = $wallet->getNewDepositReceiveAddress($user->username); UserAddressDeposit::insert(array('user_id' => $user->id, 'wallet_id' => $wallet->id, 'addr_deposit' => $address)); } catch (Exception $e) { $data['error_message'] = Lang::get('texts.not_connect_wallet'); //'Caught exception: '.$e->getMessage()."\n"; // } } else { $address = $addr_deposit->addr_deposit; } $data['address_deposit'] = $address; } $data['wallet_id'] = $wallet->id; $data['wallet'] = $wallet; return View::make('user.profile', $data); }
public function deleteMethodDeposit() { $wallet_id = Input::get('wallet_id'); $wallet = MethodDepositCurrency::find($wallet_id); if (isset($wallet->id)) { MethodDepositCurrency::where('id', $wallet_id)->delete(); $message = Lang::get('admin_messages.delete_success'); if (Input::get('isAjax')) { echo json_encode(array('status' => 'success', 'message' => $message)); exit; } else { return Redirect::to('admin/manage/method-deposit')->with('success', $message); } } else { $message = Lang::get('admin_messages.method_deposit_not_exist'); if (Input::get('isAjax')) { echo json_encode(array('status' => 'error', 'message' => $message)); exit; } else { return Redirect::to('admin/manage/method-deposit')->with('error', $message); } } }