/** * Show Manage Page of Players. * * @param Request $request * @return \Illuminate\Http\Response */ public function players(Request $request) { $page = $request->input('page', 1); $filter = $request->input('filter', ''); $q = $request->input('q', ''); if ($filter == "") { $players = Player::orderBy('uid'); } elseif ($filter == "player_name") { $players = Player::like('player_name', $q)->orderBy('uid'); } elseif ($filter == "uid") { $players = Player::where('uid', $q)->orderBy('uid'); } $total_pages = ceil($players->count() / 30); $players = $players->skip(($page - 1) * 30)->take(30)->get(); return view('admin.players')->with('players', $players)->with('filter', $filter)->with('q', $q)->with('page', $page)->with('total_pages', $total_pages); }