/** * Show reward * GET * * @param int $id * @param string $name * @return Response */ public function showObject($id, $name) { $item = RewardManager::join('item_template', 'item_template.id', '=', 'item')->where('item', $id)->first(); $nextRewards = RewardManager::join('item_template', 'item_template.id', '=', 'item')->where('votes', '>', $item->votes)->take(4)->get(); $players = PlayerManager::where('account', Auth::user()->guid)->orderBy('xp', 'asc')->get(); return view('rewards.object', compact('item', 'nextRewards', 'players')); }
/** * Show all players * GET * * @param Request $request * @return Response */ public function showCharacters(Request $request) { $name = $request->has('name') ? $request->input('name') : ''; $min_level = $request->has('level_min') ? $request->input('level_min') : 20; $max_level = $request->has('level_max') ? $request->input('level_max') : 200; $breed = $request->has('breed') ? $request->input('breed') : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; $sex = $request->has('sex') ? $request->input('sex') : [0, 1]; $sort = $request->has('sort') ? $request->input('sort') : '1B'; switch ($sort) { case '1A': $column = 'xp'; $sortBy = 'asc'; break; case '1B': $column = 'xp'; $sortBy = 'desc'; break; case '2A': $column = 'name'; $sortBy = 'asc'; break; case '2B': $column = 'name'; $sortBy = 'desc'; break; default: $column = 'xp'; $sortBy = 'desc'; break; } $characters = PlayerManager::where('name', 'like', '%' . $name . '%')->whereBetween('level', [$min_level, $max_level])->whereIn('class', $breed)->whereIn('sexe', $sex)->orderBy($column, $sortBy)->paginate(20)->appends(\Input::except('page')); $countCharacters = PlayerManager::where('name', 'like', '%' . $name . '%')->whereBetween('level', [$min_level, $max_level])->whereIn('class', $breed)->whereIn('sexe', $sex)->count(); return view('directories.characters', compact('characters', 'countCharacters')); }
/** * Show lotery page * GET * * @return Response */ public function showLotery() { $items = ItemManager::where('lotery', 1)->orderByRaw('RAND()')->take(5)->get(); $players = \App\Model\Player::where('account', Auth::user()->guid)->orderBy('xp', 'asc')->get(); return view('points.lotery', compact('items', 'players')); }
/** * Show itemset's shop page * GET * * @param int $id * @param string $name * @return Response */ public function showItemset($id, $name) { $itemset = ItemsetManager::find($id); $items = ItemTemplateManager::where('panoplie', $itemset->ID)->orderBy('level', 'desc')->get(); $otherItemsets = ItemsetManager::where('shop', 1)->where('ID', '!=', $itemset->ID)->orderByRaw('RAND()')->take(4)->get(); $players = PlayerManager::where('account', Auth::user()->guid)->orderBy('xp', 'asc')->get(); return view('shop.itemset', compact('itemset', 'items', 'players', 'otherItemsets')); }
/** * Show item shop page * GET * * @param int $id * @param string $name * @return Response */ public function showObject($id, $name) { $item = ItemManager::find($id); $players = PlayerManager::where('account', Auth::user()->guid)->orderBy('level', 'asc')->get(); return view('shop.detail', compact('item', 'players')); }
/** * Show profile * GET * * @return Response */ public function showAccount() { $players = \App\Model\Player::where('account', Auth::user()->guid)->orderBy('xp', 'desc')->get(); return view('user.account', compact('players')); }
/** * Show token of user * GET * * @param int $id * @param string $name * @return Response */ public function showToken($id, $name) { $token = TokensAccountManager::join('cms_tokens', 'cms_tokens.id', '=', 'token')->where('guid', Auth::user()->guid)->where('token', $id)->first(); $players = PlayerManager::where('account', Auth::user()->guid)->get(); $ids = explode(',', $token->items); $objectArray = []; foreach ($ids as $id) { if (!empty($id)) { array_push($objectArray, $id); } } $objects = ItemTemplateManager::whereIn('id', $objectArray)->orderBy('level', 'asc')->get(); return view('tokens.page', compact('token', 'objects', 'players')); }
/** * Show form to validate code * GET * * @param string $key * @return Response */ public function validateCode($key) { $code = CodeManager::find($key); $players = PlayerManager::where('account', Auth::user()->guid)->orderBy('xp', 'asc')->get(); return view('gift.validate', compact('code', 'players')); }