public function index(Request $request)
 {
     if ($request->user()->cannot('byond_linked')) {
         abort(403, 'Byond Account not linked');
     }
     $player = ServerPlayer::where('ckey', $request->user()->user_byond)->first();
     //Get player warning data
     $playerwarning = new PlayerWarning($request->user()->user_byond);
     return view('user.dashboard.index', array("whitelists" => $player->get_player_whitelists(), "warnings" => $playerwarning, "chars" => $player->get_chars()));
 }
 public function getPlayerData()
 {
     $players = ServerPlayer::select(['id', 'ckey']);
     return Datatables::of($players)->editColumn('ckey', '<a href="{{route(\'server.players.show\',[\'player_id\'=>$id])}}">{{$ckey}}</a>')->make();
 }
 public function getAgentList(Request $request)
 {
     $helpers = new Helpers();
     $term = $request->input('term');
     $search_key = $helpers->sanitize_ckey($term);
     //Check for proper input length
     if (strlen($term) >= 3) {
         //Get corresponding ckeys from DB
         $players = ServerPlayer::where('ckey', 'like', '%' . $search_key . '%')->lists('ckey', 'id');
         return json_encode($players);
     }
 }
 /**
  * Returns the ServerPlayer if the byond account is linked
  *
  * @return ServerPlayer
  */
 public function serverplayer()
 {
     if ($this->user_byond_linked == 1) {
         return \App\Models\ServerPlayer::where('ckey', $this->user_byond)->first();
     } else {
         return NULL;
     }
 }