public function addNewWallet() { $type = strtoupper(Input::get('type')); $name = Input::get('name'); $wallet_username = Input::get('wallet_username'); $password = Input::get('password'); $ip = Input::get('ip'); $port = Input::get('port'); $limit_confirmations = Input::get('limit_confirmations'); $is_moneypaper = Input::get('is_moneypaper'); $enable_deposit = Input::get('enable_deposit'); $enable_withdraw = Input::get('enable_withdraw'); $download_wallet_client = Input::get('download_wallet_client'); $check_wallet = Wallet::where('type', '=', $type)->first(); if (isset($check_wallet->id)) { return Redirect::to('admin/manage/wallets')->with('error', Lang::get('admin_messages.wallet_exist')); } $logo_coin = Input::file('logo_coin'); $logo = ''; if (!empty($logo_coin)) { $extension = $logo_coin->getClientOriginalExtension(); $destinationPath = 'upload/images/'; $fileName = time() . '.' . $extension; if (in_array($extension, array('jpg', 'png', 'gif'))) { if ($logo_coin->move($destinationPath, $fileName)) { $logo = $destinationPath . $fileName; } } else { return Redirect::to('admin')->with('notice', 'The extension of image invalid'); } } $wallet = new Wallet(); $wallet->type = $type; $wallet->name = $name; $wallet->wallet_username = $wallet_username; $wallet->wallet_password = $password; $wallet->wallet_ip = $ip; $wallet->port = $port; $wallet->limit_confirmations = $limit_confirmations; $wallet->download_wallet_client = $download_wallet_client; $wallet->logo_coin = $logo; $wallet->is_moneypaper = !empty($is_moneypaper) ? $is_moneypaper : 0; $wallet->enable_deposit = !empty($enable_deposit) ? $enable_deposit : 0; $wallet->enable_withdraw = !empty($enable_withdraw) ? $enable_withdraw : 0; $wallet->save(); if ($wallet->id) { $fee_withdraw = new FeeWithdraw(); $fee_withdraw->wallet_id = $wallet->id; $fee_withdraw->percent_fee = 0; $fee_withdraw->save(); return Redirect::to('admin/manage/wallets')->with('success', Lang::get('admin_messages.created_success_param', array('object' => $wallet->name))); } else { return Redirect::to('admin/manage/wallets')->with('error', Lang::get('admin_messages.not_create_wallet')); } }