public function addWithdrawCurrency()
 {
     $amount = Input::get('amount');
     $address = Input::get('to_address');
     $wallet_id = Input::get('wallet_id');
     $password = Input::get('password');
     $method_id = Input::get('method_id');
     $transaction_id = Input::get('transaction_id');
     $wallet = Wallet::find($wallet_id);
     $setting = new Setting();
     if ($setting->getSetting('disable_withdraw', 0)) {
         return Redirect::to('user/withdraw/' . $wallet->id)->with('notice', 'Sorry. we pause function withdrawals');
         //"Not connect to this wallet."
     }
     $user = Confide::user();
     $find_withdraw = Withdraw::where('user_id', $user->id)->where('wallet_id', $wallet_id)->where('status', 0)->where('created_at', '>=', date('Y-m-d'))->first();
     if (isset($find_withdraw->id)) {
         return Redirect::to('user/withdraw/' . $wallet_id)->with('error', Lang::get('messages.you_withrdawed_today'));
     }
     $balance = new Balance();
     if (Hash::check($password, Confide::user()->password)) {
         $balance_amount = $balance->getBalance($wallet->id);
         $method_withdraw = MethodWithdrawCurrency::find($method_id);
         $amount_fee = $method_withdraw->wfee * $amount / 100;
         if ($amount_fee < $method_withdraw->wminfee) {
             $amount_fee = $method_withdraw->wminfee;
         }
         if ($amount < $amount_fee) {
             return Redirect::to('user/withdraw/' . $wallet->id)->with('error', Lang::get('messages.message_min_amount', array('price' => $amount_fee)));
         } elseif ($amount > $balance_amount) {
             return Redirect::to('user/withdraw/' . $wallet->id)->with('error', Lang::get('messages.message_max_amount', array('amount' => $balance_amount)));
         } else {
             $withdraw = new Withdraw();
             $withdraw->user_id = $user->id;
             $withdraw->wallet_id = $wallet->id;
             $withdraw->to_address = $address;
             $withdraw->amount = $amount;
             $withdraw->fee_amount = $amount_fee;
             $withdraw->receive_amount = $amount - $amount_fee;
             $withdraw->status = 0;
             $withdraw->transaction_id = $transaction_id;
             $withdraw->save();
             if ($withdraw->id) {
                 /*$data_send=array('user' => $user,'withdraw_id'=>$withdraw->id,'confirmation_code'=>$confirmation_code);
                   Mail::send('emails.confirmwithdraw', $data_send, function($message) use ($user)
                   {                  
                     $message->to($user->email)->subject('Confirmation Withdrawal');
                   });   */
                 return Redirect::to('user/withdraw/' . $wallet->id)->with('success', Lang::get('messages.withdraw_created_success'));
             } else {
                 return Redirect::to('user/withdraw/' . $wallet->id)->with('error', Lang::get('messages.not_add_withdraw'));
             }
         }
     }
 }
 public function deleteMethodWithdraw()
 {
     $wallet_id = Input::get('wallet_id');
     $wallet = MethodWithdrawCurrency::find($wallet_id);
     if (isset($wallet->id)) {
         MethodWithdrawCurrency::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-withdraw')->with('success', $message);
         }
     } else {
         $message = Lang::get('admin_messages.method_withdraw_not_exist');
         if (Input::get('isAjax')) {
             echo json_encode(array('status' => 'error', 'message' => $message));
             exit;
         } else {
             return Redirect::to('admin/manage/method-withdraw')->with('error', $message);
         }
     }
 }