当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::all方法代码示例

本文整理汇总了PHP中Player::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::all方法的具体用法?PHP Player::all怎么用?PHP Player::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::all方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Show the form for creating a new resource.
  * GET /participant/create
  *
  * @return Response
  */
 public function create($id)
 {
     $user = Auth::user();
     $club = $user->clubs()->FirstOrFail();
     $followers = $club->followers;
     $players = [];
     //get player from follower (original - restricted by club)
     // foreach ($followers as $follower) {
     // 	$fuser = User::find($follower->user_id);
     // 	if($fuser->players){
     // 		foreach (User::find($follower->user_id)->players as $data) {
     // 			$data['fullname'] = "$data->firstname $data->lastname";
     // 			$data['username'] = "$fuser->profile->firstname $fuser->profile->lastname";
     // 			$data['useremail']= "$fuser->email";
     // 			$players[] = $data;
     // 		}
     // 	}
     // }
     // *********************************************************
     //per Brooks requests all player in the system are available
     //**********************************************************//
     foreach (Player::all() as $data) {
         $data['fullname'] = "{$data->firstname} {$data->lastname}";
         $data['username'] = "{$data->user}->profile->firstname {$data->user}->profile->lastname";
         $data['useremail'] = "{$data->user}->email";
         $players[] = $data;
     }
     $title = 'League Together - ' . $club->name . ' Teams';
     $event = Evento::find($id);
     $plan = $club->plans()->lists('name', 'id');
     return View::make('app.club.event.participant.create')->with('page_title', $title)->with('event', $event)->with('club', $club)->with('followers', $followers)->with('plan', $plan)->with('players', json_encode($players))->withUser($user);
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:38,代码来源:ParticipantController.php

示例2: continuous

 public function continuous()
 {
     $players = Player::all();
     $from = Input::get('from');
     $to = Input::get('to');
     $tournaments = Tournament::where('updated_at', '>=', Carbon::parse($from))->where('updated_at', '<=', Carbon::parse($to))->get();
     $tournaments->each(function ($t) use(&$players) {
         foreach ($t->orderedPlayers()->get() as $ranking => $player) {
             $players->find($player->player)->addTournamentScore($ranking);
         }
     });
     $players = $players->filter(function ($player) {
         return $player->ts > 0 && $player->name != User::GHOST;
     })->sortByDesc('ts');
     $this->display('tournaments.continuous', ['players' => $players, 'from' => $from, 'to' => $to]);
 }
开发者ID:romainmasc,项目名称:jackmarshall,代码行数:16,代码来源:TournamentsController.php

示例3: index

 public static function index()
 {
     $url = $_SERVER['REQUEST_URI'];
     $stripped_url = preg_replace("/[^A-Za-z0-9 ]/", '', $url);
     // Fetch page from cache
     $cached_page = Cache::getPage($stripped_url);
     if ($cached_page != null && Cache::on()) {
         // Use cached page (which is up to date because outdated pages are deleted)
         echo $cached_page;
     } else {
         // Make page from scratch
         $player = Player::find($_GET['player']);
         $game_count = Game::count_all_player_games($player->playerid);
         $latest_game = Game::latest_player_game($player->playerid);
         $high_scores = Game::player_high_scores($player->playerid);
         $years = Game::game_years();
         $popular_courses = Course::popular_courses($player->playerid);
         $throw_count = Score::count_all_player_scores($player->playerid);
         $birdies = Score::players_birdies($player->playerid);
         $aces = Score::players_aces($player->playerid);
         $courses_avg_scores = array();
         $names_done = false;
         foreach ($years as $year) {
             $avg_scores_by_year = Course::average_player_scoring_by_year($player->playerid, $year);
             for ($i = 0; $i < count($avg_scores_by_year); $i++) {
                 if (!$names_done) {
                     $averages = array();
                     $averages[] = $avg_scores_by_year[$i]['name'];
                     $courses_avg_scores[] = $averages;
                 }
                 if ($avg_scores_by_year[$i]['avg_score'] != null) {
                     $courses_avg_scores[$i][] = $avg_scores_by_year[$i]['avg_score'] . " (" . str_replace(" ", "", $avg_scores_by_year[$i]['to_par']) . ")";
                 } else {
                     $courses_avg_scores[$i][] = "";
                 }
             }
             $names_done = true;
         }
         $page_html = View::make('player/index.html', array('player' => $player, 'players' => Player::all(), 'game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'high_scores' => $high_scores, 'popular_courses' => $popular_courses, 'birdies' => $birdies, 'aces' => $aces, 'years' => $years, 'courses_avg_scores' => $courses_avg_scores));
         if (Cache::on()) {
             Cache::store($stripped_url, $page_html);
         }
     }
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:44,代码来源:player_controller.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rand = 'GSP' . rand(100, 100000);
     $data = Input::all();
     $validator = Validator::make($data, Player::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // Helper: File Upload in Player Model
     $check = Player::all()->count();
     if ($check >= 11) {
         return View::make('players.index')->with('message', 'You have reached the maximum number allowed');
     } else {
         $data['id_copy'] = Player::uploadFile(Input::file('id_copy'), 'id_copy');
         $data['photo'] = Player::uploadFile(Input::file('photo'), 'photo');
         $players = new Player($data);
         $players->rand_num = $rand;
         $players->save();
         return View::make('players.index')->with('message', 'file upload was successful');
     }
 }
开发者ID:Homeboyzandroid,项目名称:greensport,代码行数:26,代码来源:PlayersController.php

示例5: update

 /**
  * Checks if round is ready to be saved. If not, displays round edit page with information already inputted. If yes, attempts to update selected round and related scores.
  *
  * @param int $id Id of selected round.
  */
 public static function update($id)
 {
     $player = self::get_user_logged_in();
     if (!$player) {
         View::make('player/login.html', array('error' => 'Vain kirjautuneet käyttäjät voivat muokata ratoja.'));
     }
     $params = $_POST;
     $players = Player::all();
     $course = Course::find($params['course']);
     $courses = Course::all();
     $played = $params['played'];
     $round = Round::find($id);
     $holes = Hole::find_by_course($course->id);
     $scores = Score::find_by_round($id);
     $numberOfPlayers = sizeof($scores);
     if ($params['course'] != $params['course_orig']) {
         // If course selection has changed we need to display edit page again with new information.
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         for ($i = 1; $i <= $numberOfPlayers; $i++) {
             $holeScores = array();
             for ($j = 1; $j <= $numberOfHoles; $j++) {
                 $holeScores[] = $params['p' . $i . '_h' . $j];
             }
             $playerScores[] = array('player' => Player::find($params['player_' . $i]), 'holes' => $holeScores);
         }
         View::make('round/edit.html', array('numberOfPlayers' => $numberOfPlayers, 'players' => $players, 'course' => $course, 'holes' => $holes, 'courses' => $courses, 'playerScores' => $playerScores, 'round' => $round, 'scores' => $scores, 'played' => $played));
     } else {
         $attributes = array('courseId' => $params['course'], 'played' => $params['played']);
         $playerScores = array();
         $numberOfHoles = Hole::count_holes($params['course_orig']);
         $round = new Round(array_merge(array("id" => $round->id), $attributes));
         $errors = $round->errors();
         if (count($errors) == 0) {
             $round->update();
             for ($i = 1; $i <= $numberOfPlayers; $i++) {
                 $holeScores = array();
                 $scoreId = $params['score_' . $i];
                 for ($j = 1; $j <= $numberOfHoles; $j++) {
                     $hole = Hole::find_by_course_and_holenumber($params['course_orig'], $j);
                     $holeScores[] = array('throws' => $params['p' . $i . '_h' . $j], 'holeId' => $hole->id, 'holenumber' => $j);
                 }
                 $score = new Score(array('id' => $scoreId, 'playerId' => $params['player_' . $i], 'roundId' => $round->id, 'scores' => $holeScores));
                 $score->update();
             }
             Redirect::to('/round/' . $round->id, array('message' => 'Kierrosta muokattu.'));
         } else {
             View::make('round/new.html', array('errors' => $errors, 'attributes' => $attributes));
         }
     }
 }
开发者ID:neodyymi,项目名称:Tsoha-Bootstrap,代码行数:56,代码来源:round_controller.php

示例6: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(ChampionshipDetail $championship, Club $club, Player $player)
 {
     return view('admin.clubhistories.create')->with('championship', $championship->all())->with('club', $club->all())->with('player', $player->all());
 }
开发者ID:arikazukitomaharjan,项目名称:fcims,代码行数:9,代码来源:ClubHistoryController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $players = Player::all();
     return view('player.index', ['players' => $players]);
 }
开发者ID:PetrKonecny,项目名称:web_game,代码行数:10,代码来源:PlayerController.php

示例8: index

 public static function index()
 {
     self::check_logged_in();
     $players = Player::all();
     View::make('Player/index.html', array('players' => $players));
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:6,代码来源:player_controller.php

示例9: results

 public function results()
 {
     $players = Player::all();
     $answers = Answer::all();
     $questions = Question::all();
     return View::make('results', array('players' => $players, 'answers' => $answers, 'questions' => $questions));
 }
开发者ID:sanderdrummer,项目名称:Homepages,代码行数:7,代码来源:HomeController.php

示例10: display_score_card_pictures_by_year

 public static function display_score_card_pictures_by_year($year)
 {
     $full_path = getcwd();
     $path = str_replace("/disc-golf-stats/app/controllers", "", $full_path);
     $path = str_replace("/xamppfiles", "", $path);
     $echo = ImageDisplayer::display($path . "/score_cards", $year);
     View::make('game/score_card_images.html', array('current_year' => $year, 'images' => $echo, 'players' => Player::all(), 'courses' => Course::all(), 'game_years' => Game::game_years()));
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:8,代码来源:game_controller.php


注:本文中的Player::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。