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 updateAddress($user_id, $wallet_id, $address) { $useraddress = UserAddressDeposit::where('user_id', $user_id)->where('wallet_id', $wallet_id)->first(); if (isset($useraddress->addr_deposit)) { UserAddressDeposit::where('id', $useraddress->id)->update(array('addr_deposit' => $address)); } else { UserAddressDeposit::insert(array('user_id' => $user_id, 'wallet_id' => $wallet_id, 'addr_deposit' => $address)); } }
public function routePage($page = '', $pager_page = '') { $markets = Market::where('active', 1)->get(); $market_wallet = array(); foreach ($markets as $market) { $market_wallet[$market->id] = $market->getWalletType($market->id); } $data['markets'] = $market_wallet; switch ($page) { case 'fee': $data['fee_trades'] = FeeTrade::leftJoin('market', 'fee_trade.market_id', '=', 'market.id')->leftJoin('wallets', 'market.wallet_from', '=', 'wallets.id')->select('fee_trade.*', 'market.wallet_from', 'wallets.name', 'wallets.type')->orderby('wallets.name', 'asc')->get(); //echo "<pre>fee_trades: "; print_r($fee_trades); echo "</pre>"; //echo "<pre>markets: "; print_r($markets); echo "</pre>";exit; return View::make('admin.setting_fee', $data); break; case 'fee-withdraw': $data['fee_withdraws'] = FeeWithdraw::leftjoin('wallets', 'fee_withdraw.wallet_id', '=', 'wallets.id')->select('fee_withdraw.*', 'wallets.type', 'wallets.name')->orderby('wallets.type')->get(); return View::make('admin.setting_fee_withdraw', $data); break; case 'limit-trade': $record_per_page = 15; $total = WalletLimitTrade::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $data['wallets'] = Wallet::orderby('type')->get(); $data['limit_trades'] = WalletLimitTrade::leftjoin('wallets', 'wallet_limittrade.wallet_id', '=', 'wallets.id')->select('wallet_limittrade.*', 'wallets.type as wallet_type', 'wallets.name as wallet_name')->skip($offset_start)->take($record_per_page)->orderby('wallet_type')->get(); return View::make('admin.limittrade.setting_limittrade', $data); break; //add newbie //add newbie case 'time-limit-trade': $record_per_page = 15; $total = WalletTimeLimitTrade::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $data['wallets'] = Wallet::orderby('type')->get(); $data['limit_trades'] = WalletTimeLimitTrade::leftjoin('wallets', 'wallet_timelimittrade.wallet_id', '=', 'wallets.id')->select('wallet_timelimittrade.*', 'wallets.type as wallet_type', 'wallets.name as wallet_name')->skip($offset_start)->take($record_per_page)->orderby('wallet_type')->get(); return View::make('admin.limittrade.setting_timelimittrade', $data); break; case 'statistic-coin-exchanged': $select = "SELECT mk.wallet_from, mk.wallet_to, sum(amount) as total_amount from trade_history a left join market mk on a.market_id=mk.id"; $select_maincoin = "SELECT mk.wallet_from, mk.wallet_to, sum(amount*price) as total_amount from trade_history a left join market mk on a.market_id=mk.id"; $where = ''; if (isset($_GET['filter_time']) && $_GET['filter_time'] != '') { switch ($_GET['filter_time']) { case 'hourly': $hourly = date('Y-m-d H:i:s', strtotime('-1 hour')); $where = $where == '' ? " Where a.created_at>='" . $hourly . "'" : $where . " Where a.created_at>='" . $hourly . "'"; break; case 'daily': $daily = date('Y-m-d H:i:s', strtotime('-24 hour')); $where = $where == '' ? " Where a.created_at>='" . $daily . "'" : $where . " Where a.created_at>='" . $daily . "'"; break; case 'weekly': $thisweek = date('Y-m-d', strtotime('-7 day')); $where = $where == '' ? " Where a.created_at>='" . $thisweek . "'" : $where . " Where a.created_at>='" . $thisweek . "'"; break; case 'monthly': $thismonth = date('Y-m-1', strtotime('-1 month')); $where = $where == '' ? " Where a.created_at>='" . $thismonth . "'" : $where . " Where a.created_at>='" . $thismonth . "'"; break; } } $select .= " " . $where . " group by mk.wallet_from"; $coins_exchanged = DB::select($select); $data['coins_exchanged'] = $coins_exchanged; $select_maincoin .= " " . $where . " group by mk.wallet_to"; $maincoins_exchanged = DB::select($select_maincoin); $data['maincoins_exchanged'] = $maincoins_exchanged; // echo "<pre>"; print_r($fees); echo "</pre>"; $wallets_temp = Wallet::get(); $wallets = array(); foreach ($wallets_temp as $wallet) { $wallets[$wallet->id] = $wallet; } $data['wallets'] = $wallets; return View::make('admin.statistics.statistic_coin_exchanged', $data); break; case 'statistic-fees': $select = "SELECT mk.wallet_from, mk.wallet_to, sum(fee_sell) as fee_sell, sum(fee_buy) as fee_buy from trade_history a left join market mk on a.market_id=mk.id"; $where = ''; if (isset($_GET['filter_time']) && $_GET['filter_time'] != '') { switch ($_GET['filter_time']) { case 'hourly': $hourly = date('Y-m-d H:i:s', strtotime('-1 hour')); $where = $where == '' ? " Where a.created_at>='" . $hourly . "'" : $where . " Where a.created_at>='" . $hourly . "'"; break; case 'daily': $daily = date('Y-m-d H:i:s', strtotime('-24 hour')); $where = $where == '' ? " Where a.created_at>='" . $daily . "'" : $where . " Where a.created_at>='" . $daily . "'"; break; case 'weekly': $thisweek = date('Y-m-d', strtotime('-7 day')); $where = $where == '' ? " Where a.created_at>='" . $thisweek . "'" : $where . " Where a.created_at>='" . $thisweek . "'"; break; case 'monthly': $thismonth = date('Y-m-1', strtotime('-1 month')); $where = $where == '' ? " Where a.created_at>='" . $thismonth . "'" : $where . " Where a.created_at>='" . $thismonth . "'"; break; } } $select .= " " . $where . " group by a.market_id order by `created_at` desc"; $fees = DB::select($select); $data['fees'] = $fees; // echo "<pre>"; print_r($fees); echo "</pre>"; $wallets_temp = Wallet::get(); $wallets = array(); foreach ($wallets_temp as $wallet) { $wallets[$wallet->id] = $wallet; } $data['wallets'] = $wallets; return View::make('admin.statistics.statistic_fees', $data); break; case 'statistic-fee-withdraw': $select = "SELECT w.type, w.name, sum(fee_amount) as total_fee from withdraws a left join wallets w on a.wallet_id=w.id"; $where = ''; if (isset($_GET['filter_time']) && $_GET['filter_time'] != '') { switch ($_GET['filter_time']) { case 'hourly': $hourly = date('Y-m-d H:i:s', strtotime('-1 hour')); $where = $where == '' ? " Where a.created_at>='" . $hourly . "'" : $where . " Where a.created_at>='" . $hourly . "'"; break; case 'daily': $daily = date('Y-m-d H:i:s', strtotime('-24 hour')); $where = $where == '' ? " Where a.created_at>='" . $daily . "'" : $where . " Where a.created_at>='" . $daily . "'"; break; case 'weekly': $thisweek = date('Y-m-d', strtotime('-7 day')); $where = $where == '' ? " Where a.created_at>='" . $thisweek . "'" : $where . " Where a.created_at>='" . $thisweek . "'"; break; case 'monthly': $thismonth = date('Y-m-1', strtotime('-1 month')); $where = $where == '' ? " Where a.created_at>='" . $thismonth . "'" : $where . " Where a.created_at>='" . $thismonth . "'"; break; } } $select .= " " . $where . " group by a.wallet_id"; $withdraw_fees = DB::select($select); $data['withdraw_fees'] = $withdraw_fees; return View::make('admin.statistics.statistic_fee_withdraw', $data); break; case 'add-page': $data['type'] = 'page'; return View::make('admin.pages.add_post', $data); break; case 'add-news': $data['type'] = 'news'; return View::make('admin.pages.add_post', $data); break; case 'all-page': $data['type'] = 'page'; $record_per_page = 15; $total = Post::where('type', $data['type'])->count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $posts = Post::where('type', $data['type'])->skip($offset_start)->take($record_per_page)->get(); $data['posts'] = $posts; return View::make('admin.pages.all_posts', $data); break; case 'all-news': $data['type'] = 'news'; $record_per_page = 15; $total = Post::where('type', $data['type'])->count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $posts = Post::where('type', $data['type'])->skip($offset_start)->take($record_per_page)->get(); $data['posts'] = $posts; return View::make('admin.pages.all_posts', $data); break; case 'users': $record_per_page = 15; $total_users = User::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; //$offset_end = ($pager_page*$record_per_page)-1; $users = User::skip($offset_start)->take($record_per_page)->get()->toArray(); foreach ($users as $key => $value) { $user = USer::find($value['id']); $users[$key]['roles'] = $user->roles->toArray(); //echo "<pre>roles:"; print_r($user->roles->toArray()); echo "</pre>"; } //echo "<pre>"; print_r($users); echo "</pre>"; $roles = Role::get(); $data['users'] = $users; $data['roles'] = $roles; return View::make('admin.user.manage_users', $data); break; case 'orders': $record_per_page = 15; if ($pager_page == '') { $pager_page = 1; } $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; //$offset_end = ($pager_page*$record_per_page)-1; $select = "select a.*, b.wallet_from as `from`, b.wallet_to as `to`, c.username from orders a left join market b on a.market_id=b.id left join users c on a.user_id=c.id"; $select_count = "select count(*) as total from orders a"; $where = ''; if (isset($_GET['do_filter'])) { if ($where == '') { if (!empty($_GET['market'])) { $where = $where == '' ? " Where a.market_id='" . $_GET['market'] . "'" : $where . " AND a.market_id='" . $_GET['market'] . "'"; } } if ($_GET['status'] != '') { $where = $where == '' ? " Where a.status='" . $_GET['status'] . "'" : $where . " AND a.status='" . $_GET['status'] . "'"; } if ($_GET['type'] != '') { $where = $where == '' ? " Where a.type='" . $_GET['type'] . "'" : $where . " AND a.type='" . $_GET['type'] . "'"; } } $select_count = $select_count . " " . $where . " order by `created_at` desc"; $total_records = DB::select($select_count); //echo "<pre>total_records: "; print_r($total_records); echo "</pre>"; exit; $data['total_pages'] = ceil($total_records[0]->total / $record_per_page); $select .= " " . $where . " order by `created_at` desc limit " . $offset_start . "," . $record_per_page; $ordershistory = DB::select($select); $data['ordershistories'] = $ordershistory; return View::make('admin.orders', $data); break; case 'trade-histories': $record_per_page = 15; if ($pager_page == '') { $pager_page = 1; } $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $select = "select a.*, b.wallet_from as `from`, b.wallet_to as `to`,c.username as seller, d.username as buyer from trade_history a left join market b on a.market_id=b.id left join users c on a.seller_id=c.id left join users d on a.buyer_id=d.id"; $select_count = "select count(*) as total from trade_history a"; $where = ''; if (isset($_GET['do_filter'])) { if ($where == '') { if (!empty($_GET['market'])) { $where = $where == '' ? " Where a.market_id='" . $_GET['market'] . "'" : $where . " AND a.market_id='" . $_GET['market'] . "'"; } } if ($_GET['type'] != '') { $where = $where == '' ? " Where a.type='" . $_GET['type'] . "'" : $where . " AND a.type='" . $_GET['type'] . "'"; } if ($_GET['time'] != '') { switch ($_GET['time']) { case 'today': $where = $where == '' ? " Where a.created_at>='" . date("Y-m-d") . "'" : $where . " Where a.created_at>='" . date("Y-m-d") . "'"; break; case 'thisweek': $thisweek = date('Y-m-d', strtotime('this week')); $where = $where == '' ? " Where a.created_at>='" . $thisweek . "'" : $where . " Where a.created_at>='" . $thisweek . "'"; break; case 'thismonth': $thismonth = date('Y-m-1', strtotime('this month')); $where = $where == '' ? " Where a.created_at>='" . $thismonth . "'" : $where . " Where a.created_at>='" . $thismonth . "'"; break; } } } $select_count = $select_count . " " . $where . " order by `created_at` desc"; $total_records = DB::select($select_count); //echo "<pre>total_records: "; print_r($total_records); echo "</pre>"; exit; $data['total_pages'] = ceil($total_records[0]->total / $record_per_page); $select .= " " . $where . " order by `created_at` desc limit " . $offset_start . "," . $record_per_page; $trades = DB::select($select); $data['tradehistories'] = $trades; return View::make('admin.trade_histories', $data); break; case 'coins-voting': $coinvotes = DB::table('coin_votes')->get(); $wallet = Wallet::where('type', 'BTC')->first(); if (isset($wallet->id)) { try { $wallet->connectJsonRPCclient($wallet->wallet_username, $wallet->wallet_password, $wallet->wallet_ip, $wallet->port); foreach ($coinvotes as $key => $value) { $num_vote = Vote::where('coinvote_id', '=', $value->id)->count(); //echo "<pre>getreceivedbyaccount"; print_r($wallet->getReceivedByAddress($value->btc_address)); echo "</pre>";//$value->label_address $btc_payment = $wallet->getReceivedByAddress($value->btc_address); //'12X9jVe4S8pAqJ7EoKN7B4YwMQpzfgArtX' $num_payment = floor($btc_payment / 0.0001); //echo "btc_payment: ".$btc_payment; //echo "<br>num_payment: ".$num_payment; $coinvotes[$key]->balance = $num_payment; $coinvotes[$key]->num_vote = $num_vote + $num_payment; } } catch (Exception $e) { $data['error_message'] = "Not connect to this"; //'Caught exception: '.$e->getMessage()."\n"; // } //echo "<pre>coinvotes"; print_r($coinvotes); echo "</pre>"; $data['coinvotes'] = $coinvotes; } else { $data['not_wallet'] = "Please add BTC wallet before add the vote coin."; } return View::make('admin.coins_voting', $data); break; case 'funds': $wallets = Wallet::leftjoin('fee_withdraw', 'fee_withdraw.wallet_id', '=', 'wallets.id')->orderby('type')->get(); $balances = array(); $fee_withdraws = array(); foreach ($wallets as $wallet) { try { $wallet->connectJsonRPCclient($wallet->wallet_username, $wallet->wallet_password, $wallet->wallet_ip, $wallet->port); $balances[$wallet->id] = $wallet->getBalance(); $fee_withdraws[$wallet->id] = $wallet->getTxFee(); UserAddressDeposit::insert(array('user_id' => $user->id, 'wallet_id' => $wallet->id, 'addr_deposit' => $address)); } catch (Exception $e) { $data['error_message'] = 'Caught exception: ' . $e->getMessage() . "\n"; //"Not connect to this wallet";//'Caught exception: '.$e->getMessage()."\n"; } } $data['wallets'] = $wallets; $data['balances'] = $balances; $data['fee_withdraws'] = $fee_withdraws; //echo "<pre>fee_withdraws"; print_r($fee_withdraws); echo "</pre>"; return View::make('admin.funds', $data); break; case 'withdraws-queue': $record_per_page = 20; if ($pager_page == '') { $pager_page = 1; } $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; if (isset($_GET['do_filter'])) { $withdraws = Withdraw::leftjoin('users', 'users.id', '=', 'withdraws.user_id'); if ($_GET['wallet_id'] != '') { $withdraws->where('wallet_id', $_GET['wallet_id']); } if ($_GET['status'] != '') { $withdraws->where('status', $_GET['status']); } if ($_GET['username'] != '') { $withdraws->where('users.username', $_GET['username']); } $withdraws->select('withdraws.*', 'users.username', 'users.id as user_id'); } else { $withdraws = Withdraw::leftjoin('users', 'users.id', '=', 'withdraws.user_id')->select('withdraws.*', 'users.username'); } $total_records = $withdraws->get(); //echo "<br>total_records: ".count($total_records); $data['total_pages'] = ceil(count($total_records) / $record_per_page); //echo "<br>total_records: ".$data['total_pages']; $withdraws = $withdraws->skip($offset_start)->take($record_per_page)->orderby("created_at", "desc")->get(); $wallets = Wallet::orderby('type')->get()->toArray(); $new_wallet = array(); foreach ($wallets as $key => $value) { $new_wallet[$value['id']] = $value; } $data['wallets'] = $new_wallet; $data['withdraws'] = $withdraws; $data['users'] = User::orderBy('username')->get(); return View::make('admin.withdraws_queue', $data); break; case 'deposits-queue': $record_per_page = 20; if ($pager_page == '') { $pager_page = 1; } $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; if (isset($_GET['do_filter'])) { $deposits = Deposit::leftjoin('users', 'users.id', '=', 'deposits.user_id'); if ($_GET['wallet_id'] != '') { $deposits->where('wallet_id', $_GET['wallet_id']); } if ($_GET['status'] != '') { $deposits->where('paid', $_GET['status']); } if ($_GET['username'] != '') { $deposits->where('users.username', $_GET['username']); } $deposits->select('deposits.*', 'users.username', 'users.id as user_id'); } else { $deposits = Deposit::leftjoin('users', 'users.id', '=', 'deposits.user_id')->select('deposits.*', 'users.username'); } $total_records = $deposits->get(); //echo "<br>total_records: ".count($total_records); $data['total_pages'] = ceil(count($total_records) / $record_per_page); //echo "<br>total_records: ".$data['total_pages']; $deposits = $deposits->skip($offset_start)->take($record_per_page)->orderby("created_at", "desc")->get(); $wallets = Wallet::orderby('type')->get()->toArray(); $new_wallet = array(); foreach ($wallets as $key => $value) { $new_wallet[$value['id']] = $value; } $data['wallets'] = $new_wallet; $data['deposits'] = $deposits; $data['users'] = User::orderBy('username')->get(); return View::make('admin.deposits_queue', $data); break; case 'wallets': $record_per_page = 15; $total_users = Wallet::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $wallets = Wallet::skip($offset_start)->take($record_per_page)->orderby('name')->get(); $data['wallets'] = $wallets; return View::make('admin.wallet.manage_wallets', $data); break; case 'markets': $record_per_page = 15; $total_users = Market::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $markets = Market::skip($offset_start)->take($record_per_page)->get(); $data['markets'] = $markets; $wallets_temp = Wallet::orderby('type')->get(); $wallets = array(); foreach ($wallets_temp as $wallet) { $wallets[$wallet->id] = $wallet; } $data['wallets'] = $wallets; return View::make('admin.manage_markets', $data); break; case 'balance-wallets': $record_per_page = 15; $total_users = Wallet::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $wallets = Wallet::skip($offset_start)->take($record_per_page)->orderby('name')->get(); $amount_transaction = array(); $balances = array(); foreach ($wallets as $wallet) { //get total deposit $total_deposit = Deposit::where('wallet_id', $wallet->id)->where('paid', 1)->sum('amount'); $total_withdraw = Withdraw::where('wallet_id', $wallet->id)->where('status', 1)->sum('receive_amount'); $amount_transaction[$wallet->id] = array('total_amount_deposit' => $total_deposit, 'total_amount_withdraw' => $total_withdraw); try { $wallet->connectJsonRPCclient($wallet->wallet_username, $wallet->wallet_password, $wallet->wallet_ip, $wallet->port); $balances[$wallet->id] = $wallet->getBalance(); } catch (Exception $e) { $balances[$wallet->id] = Lang::get('messages.cannot_connect'); } } $data['wallets'] = $wallets; $data['amount_transaction'] = $amount_transaction; $data['balances'] = $balances; return View::make('admin.wallet.manage_wallets_balance', $data); break; case "login-histories": $record_per_page = 15; if ($pager_page == '') { $pager_page = 1; } $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; //$offset_end = ($pager_page*$record_per_page)-1; $select = "select a.*, b.username from login_history a left join users b on a.user_id=b.id"; $select_count = "select count(*) as total from login_history as a"; $where = ''; if (isset($_GET['do_filter'])) { if ($where == '') { if (!empty($_GET['user'])) { $where = $where == '' ? " Where a.user_id='" . $_GET['user'] . "'" : $where . " AND a.user='******'user'] . "'"; } } } $select_count = $select_count . " " . $where; $total_records = DB::select($select_count); //echo "<pre>total_records: "; print_r($total_records); echo "</pre>"; exit; $data['total_pages'] = ceil($total_records[0]->total / $record_per_page); $select .= " " . $where . " order by `date` desc limit " . $offset_start . "," . $record_per_page; $login_histories = DB::select($select); $data['login_histories'] = $login_histories; $users = User::orderby('username')->get(); $data['users'] = $users; return View::make('admin.user.login_histories', $data); break; case 'method-deposit': $record_per_page = 15; $total_users = MethodDepositCurrency::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $MethodDepositCurrency = MethodDepositCurrency::skip($offset_start)->take($record_per_page)->get(); $data['MethodDepositCurrency'] = $MethodDepositCurrency; return View::make('admin.method-deposit-currency.manage_method_deposit', $data); break; case 'method-withdraw': $record_per_page = 15; $total_users = MethodWithdrawCurrency::count(); if ($pager_page == '') { $pager_page = 1; } $data['total_pages'] = ceil($total_users / $record_per_page); //15 user per page $data['cur_page'] = $pager_page; $offset_start = ($pager_page - 1) * $record_per_page; $MethodWithdrawCurrency = MethodWithdrawCurrency::skip($offset_start)->take($record_per_page)->get(); $data['MethodWithdrawCurrency'] = $MethodWithdrawCurrency; return View::make('admin.method-withdraw-currency.manage_method_withdraw', $data); break; default: $setting = new Setting(); //$data['bg_color']=$setting->getSetting('bg_color',''); $data['site_mode'] = $setting->getSetting('site_mode', 0); //$data['bg_file']=$setting->getSetting('bg_file',''); $data['disable_withdraw'] = $setting->getSetting('disable_withdraw', 0); $data['recaptcha_publickey'] = $setting->getSetting('recaptcha_publickey', ''); $data['recaptcha_privatekey'] = $setting->getSetting('recaptcha_privatekey', ''); $data['amount_btc_per_vote'] = $setting->getSetting('amount_btc_per_vote', 0.0001); //pusher app $data['pusher_app_id'] = $setting->getSetting('pusher_app_id', ''); $data['pusher_app_key'] = $setting->getSetting('pusher_app_key', ''); $data['pusher_app_secret'] = $setting->getSetting('pusher_app_secret', ''); //default_market $m_default = Market::where('active', 1)->orderBy('id')->first(); $market_default_id = isset($m_default->id) ? $m_default->id : 0; $data['default_market'] = $setting->getSetting('default_market', $market_default_id); //setting points $data['disable_points'] = $setting->getSetting('disable_points', 0); $data['point_per_btc'] = $setting->getSetting('point_per_btc', 1); $data['percent_point_reward_trade'] = $setting->getSetting('percent_point_reward_trade', 0); $data['percent_point_reward_referred_trade'] = $setting->getSetting('percent_point_reward_referred_trade', 0); $data['max_amount_funds'] = $setting->getSetting('max_amount_funds', 1000); //echo "<pre>data: "; print_r($data); echo "</pre>"; exit; return View::make('admin.setting', $data); break; } }