コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('user_roles')->insert(['id' => 1, 'name' => 'Admin', 'identifier' => 'admin']);
     DB::table('users')->insert(['id' => 'user_id', 'name' => 'Matt Higgins', 'email' => '*****@*****.**', 'password' => bcrypt('testing'), 'user_role_id' => 1]);
     $player = new Player();
     $player->first_name = 'Matt';
     $player->last_name = 'Higgins';
     $player->email = '*****@*****.**';
     $player->user_id = 1;
     $player->save();
     DB::table('match_types')->insert([['id' => 1, 'name' => 'Singles', 'identifier' => 'singles'], ['id' => 2, 'name' => 'Doubles', 'identifier' => 'doubles']]);
     // Create players
     // $playerCount = 20;
     // factory(App\Player::class, $playerCount)->create();
     // // Create events with matches and teams
     // factory(App\Event::class, 10)->create()->each(function($event) {
     //     $event->matches()->saveMany(factory(App\Match::class, rand(2,5))->create()->each(function($match) use ($event) {
     //         $teams = factory(App\Team::class, 2)->make();
     //         $match->teams()->saveMany($teams);
     //         $event->teams()->saveMany($teams);
     //         $result = new MatchResult;
     //         $result->match_id = $match->id;
     //         $result->winning_team_id = $teams[0]->id;
     //         $result->losing_team_id = $teams[1]->id;
     //         $result->winning_score = rand(5,8);
     //         $result->losing_score = $result->winning_score - 2;
     //         $result->save();
     //     }));
     // });
     // $playerId = 1;
     // Team::all()->each(function($team, $key) use (&$playerId){
     //     for($i=0;$i<2;$i++)
     //     {
     //         $player = Player::find($playerId);
     //         if($player)
     //         {
     //             $team->players()->save($player);
     //         }else{
     //             $playerId = 1;
     //             $player = Player::find($playerId);
     //             $team->players()->save($player);
     //         }
     //         $playerId++;
     //     }
     // });
     // Event::all()->each(function($event){
     //     foreach($event->matches as $match)
     //     {
     //         $event->players()->saveMany($match->players());
     //     }
     // });
     Model::reguard();
 }
コード例 #2
0
ファイル: Kernel.php プロジェクト: huludini/aura-kingdom-web
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->call(function () {
         $players = DB::connection('game')->table('player_characters')->get();
         foreach ($players as $player) {
             if (!Player::where('id', $player->id)->exists()) {
                 $player_info = ['id' => $player->id, 'name' => $player->given_name, 'level' => $player->level, 'class' => 0, 'gold' => $player->gold, 'family_name' => $player->family_id ? DB::connection('game')->table('family')->where('id', $player->family_id)->first()->name : '-'];
                 Player::create($player_info);
             }
         }
     })->everyTenMinutes();
     $schedule->call(function () {
         $families = DB::connection('game')->table('family')->get();
         foreach ($families as $family) {
             if (!Family::where('id', $family->id)->exists()) {
                 $gold = 0;
                 foreach (DB::connection('game')->table('player_characters')->where('family_id', $family->id)->get() as $player) {
                     $gold += $player->gold;
                 }
                 $family_info = ['id' => $family->id, 'name' => $family->name, 'level' => $family->lv, 'gold' => $gold, 'members' => DB::connection('game')->table('player_characters')->where('family_id', $family->id)->count(), 'leader' => DB::connection('game')->table('player_characters')->where('id', $family->leader_id)->first()->given_name];
                 Family::create($family_info);
             }
         }
     })->everyTenMinutes();
 }
コード例 #3
0
ファイル: PlayersController.php プロジェクト: kbiyo/ARTTv2
 public function playerDetail($id, $name)
 {
     $player = Player::find($id);
     if ($player == null) {
         abort(404);
     }
     $pname = strtolower(str_slug($player->prenom) . '-' . str_slug($player->nom));
     if (strtolower($name) != $pname) {
         abort(404);
     }
     $histo = array();
     foreach ($player->RankHistos()->orderBy('saison', 'asc')->orderBy('phase', 'asc')->get() as $rankHisto) {
         $saison = str_replace('Saison ', '', $rankHisto->saison);
         if ($rankHisto->phase == '1') {
             $saison = substr($saison, 0, 4);
             $saison = $saison . ' Q3';
         } else {
             $saison = substr($saison, 0, 4) + 1;
             $saison = $saison . ' Q1';
         }
         array_push($histo, array('saison' => $saison, 'point' => $rankHisto->point));
     }
     $adversaires = $player->Versuses()->orderBy('advclaof')->get();
     $advgrp = $adversaires->groupBy('advclaof');
     $vdgrp = $adversaires->groupBy('vd');
     $adv = array();
     foreach ($advgrp as $key => $versus) {
         array_push($adv, array('adv' => $key, 'nb' => count($versus)));
     }
     $vd = array();
     foreach ($vdgrp as $key => $versus) {
         array_push($vd, array('label' => $key == 'V' ? 'Victoires' : 'Defaites', 'value' => count($versus)));
     }
     return view('front.players.detail', array('player' => $player, 'histo' => $histo, 'adv' => $adv, 'vd' => $vd, 'rencontres' => $adversaires->sortByDesc('datef')->groupBy('date')));
 }
コード例 #4
0
ファイル: BaseController.php プロジェクト: kakitsubun/wc-test
 /**
  * 构建
  * BaseController constructor.
  */
 public function __construct()
 {
     // 认证
     $objUser = Auth::user();
     $intPlayerId = $objUser->id;
     $this->_intPlayerId = $intPlayerId;
     $this->_strDeviceId = $intPlayerId;
     echo "====================================<br />";
     echo "[TOP INFO]PlayerId:" . $this->_intPlayerId . "DeviceId:" . $this->_strDeviceId . "<br />";
     echo "[TOP 菜单] ";
     echo "<a href='/game?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>测试TOP</a> ";
     echo "<a href='/game/player?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>玩家情报TOP</a> ";
     echo "<a href='/game/player/team?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>玩家队伍编辑</a> ";
     echo "<a href='/game/player/card-box?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>玩家卡片Box</a> ";
     echo "<a href='/game/player/equipment-box?player_id=" . $this->_intPlayerId . "&device_id=" . $this->_strDeviceId . "'>玩家装备Box</a>";
     echo "<br />";
     echo "====================================<br />";
     // 初始化玩家数据
     $objPlayer = Player::find($this->_intPlayerId);
     $objPlayerData = PlayerData::find($objPlayer->id);
     $this->_lstPlayer = array_merge($objPlayerData->toArray(), $objPlayer->toArray());
     echo "[TOP 玩家状态] <br />";
     echo "Lv." . $this->_lstPlayer["level"] . " 体力:" . $this->_lstPlayer["stamina"] . "/" . $this->_lstPlayer["max_stamina"];
     echo " 魔法石:" . $this->_lstPlayer["stone"];
     echo " 金币:" . $this->_lstPlayer["money"];
     echo "<br />";
     echo "====================================<br />";
 }
コード例 #5
0
ファイル: HomeController.php プロジェクト: kbiyo/ARTTv2
 public function Home()
 {
     $nbPlayersWithoutPhoto = Player::where('photo', null)->count();
     $nbPlayersWithoutEmail = Player::where('email', null)->count();
     //$nbTeamsWithoutCaptain = Player::where('photo', null)->count();
     return view('admin.home', array('nbPlayersWithoutPhoto' => $nbPlayersWithoutPhoto, 'nbPlayersWithoutEmail' => $nbPlayersWithoutEmail));
 }
コード例 #6
0
ファイル: WonSet.php プロジェクト: stefanledin/mmpingis
 /**
  * Handle the event.
  *
  * @param  PlayerWonSet  $event
  * @return void
  */
 public function handle(PlayerWonSet $event)
 {
     $match = Match::find($event->player->match->id);
     $player = Player::find($event->player->id);
     $player->sets_won += 1;
     $player->save();
 }
コード例 #7
0
ファイル: TestApi.php プロジェクト: stefanledin/mmpingis
 function test_first_point()
 {
     $this->dummyData();
     $this->assertEquals(0, Player::find($this->player1->id)->points);
     $response = $this->call('GET', '/player/1/addpoint');
     $this->assertEquals(200, $response->status());
     $this->assertEquals(1, Player::find($this->player1->id)->points);
 }
コード例 #8
0
 /**
  * Joins the game of another person
  */
 public function join()
 {
     $players = Player::where('user_id', Auth::id())->get();
     $gameIds = $players->lists('game_id')->toArray();
     $game = Game::whereNotIn('id', $gameIds)->where(['state' => Game::STATE_OPEN])->first();
     if (is_null($game)) {
         session()->flash('error', sprintf(self::ERROR_NO_GAMES_FOUND, Auth::user()->name));
         return redirect()->route('welcome');
     }
     $player = new Player();
     $player->game_id = $game->id;
     $player->user_id = Auth::id();
     $player->troops = 5;
     $player->save();
     session()->flash('success', sprintf(self::MESSAGE_JOINED_GAME, Auth::user()->name));
     return redirect()->route(self::ROUTE_SHOW_GAME, [$game->id]);
 }
コード例 #9
0
ファイル: HomeController.php プロジェクト: NikaBuligini/xo
 public function createBoard()
 {
     $table = json_encode([[['state' => 0], ['state' => 0], ['state' => 0]], [['state' => 0], ['state' => 0], ['state' => 0]], [['state' => 0], ['state' => 0], ['state' => 0]]]);
     $board = Board::create(['table' => $table, 'moves' => 0, 'finished' => false]);
     $player1 = Player::create(['user_id' => 1, 'board_id' => $board->id, 'winner' => null]);
     $player2 = Player::create(['user_id' => 1, 'board_id' => $board->id, 'winner' => null]);
     return redirect('/');
 }
コード例 #10
0
 public function __construct()
 {
     // Always run csrf protection before the request when posting
     $playerId = Input::get('player_id');
     $player = Player::find($playerId);
     $this->_player = $player;
     $this->_playerData = PlayerData::find($player->id);
 }
コード例 #11
0
 /**
  * Show the form for inviting a new resource.
  *
  * @return Response
  */
 public function invite($player)
 {
     //TODO get rid of entry variable
     $entry = 1;
     $players = Player::orderby('last_name')->orderby('first_name')->get();
     $players_list = $players->lists('last_first_name', 'player_id');
     return view('pages/players/journal/evaluation/invite', compact('player', 'players_list', 'entry'));
 }
コード例 #12
0
 public function run()
 {
     DB::table('players')->delete();
     $playersArray = [['name' => 'Iron Man', 'war_id' => 4], ['name' => 'Gaurdians Of The Galaxy', 'war_id' => 4], ['name' => 'Batman Begins', 'war_id' => 4], ['name' => 'X-Men', 'war_id' => 4], ['name' => 'Captain America: The First Avenger', 'war_id' => 4], ['name' => 'Superman II', 'war_id' => 4], ['name' => 'Captain America: The Winter Soldier', 'war_id' => 4], ['name' => 'X2: X-Men United', 'war_id' => 4], ['name' => 'X-Men: First Class', 'war_id' => 4], ['name' => 'Superman: The Movie', 'war_id' => 4], ['name' => 'Batman', 'war_id' => 4], ['name' => 'The Avengers', 'war_id' => 4], ['name' => 'The Incredibles', 'war_id' => 4], ['name' => 'The Dark Knight', 'war_id' => 4]];
     foreach ($playersArray as $key => $player) {
         Player::create($player);
     }
 }
コード例 #13
0
 /**
  * Search players. If direct match, send to player page. If not, return all results to search results view.
  *
  * @param SearchRequest|Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
  */
 public function playerSearch(SearchRequest $request)
 {
     $player = Player::where('name', $request->input('searchTerm'))->first();
     if ($player) {
         return redirect(route('view-player', array('id' => $player->accountID)));
     }
     $results = Player::where('name', 'LIKE', '%' . $request->input('searchTerm') . '%')->paginate(15);
     return view('search.results', compact('results'));
 }
コード例 #14
0
 public function test_player1_wins_match()
 {
     $player1 = new Player(['points' => 10, 'sets_won' => 1]);
     $player2 = new Player(['points' => 9, 'sets_won' => 1]);
     $match = Match::create();
     $match->players()->saveMany([$player1, $player2]);
     $match->addPointFor($player1);
     $this->assertEquals($player1->id, Match::find($match->id)->won_by);
     $this->assertEquals(2, Player::find($player1->id)->sets_won);
 }
コード例 #15
0
ファイル: TeamController.php プロジェクト: rcabr497/beerPong
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // This method finds the player by id. so the url would be players/1
     // If an id of 1 doesn't exist laravel will throw an exception
     $team = Team::findOrFail($id);
     $players = Player::orderBy('first_name', 'asc')->get();
     // This passes the data to the view. The compact function is shorthand for an array.
     // In the view you would use $player to access all the columns
     return view('teams.edit', compact('team', 'players'));
 }
コード例 #16
0
 function test_it_works()
 {
     $player = new Player(['nickname' => 'Stefan', 'points' => 10]);
     $opponent = new Player(['nickname' => 'Fredrik', 'points' => 9]);
     $match = Match::create(['set' => 2]);
     $match->players()->saveMany([$player, $opponent]);
     Event::fire(new App\Events\PlayerWonSet($player));
     $this->assertEquals(2, Match::find($match->id)->currentSet());
     $this->assertEquals(1, Player::find($player->id)->sets_won);
 }
コード例 #17
0
ファイル: Game.php プロジェクト: VovikeMS/darts
 public function getPlayers()
 {
     $players = [];
     foreach ($this->Scores->groupBy('player_id') as $id => $t) {
         $players[] = Player::where('id', '=', $id)->first();
     }
     if (count($players) > 0) {
         return $players;
     }
     return false;
 }
コード例 #18
0
ファイル: FFTTUpdatePlayers.php プロジェクト: kbiyo/ARTTv2
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Players] STARTING');
     $licencies = xml_liste_joueur_o('18270175');
     Player::where('active', 1)->update(['active' => 0, 'saison' => date('Y') . '-' . (date('Y') - 1)]);
     foreach ($licencies as $licencie) {
         Artisan::queue('FFTT:Player', ['licence' => $licencie->licence]);
         $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Players] ' . $licencie->licence . ' ending');
     }
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Players] ENDED');
 }
コード例 #19
0
 public function getPlayers()
 {
     //全部消す
     foreach (Player::all() as $player) {
         $player->delete();
     }
     //一覧更新
     $client = new Client();
     $crawler = $client->request('GET', 'http://www.wtatennis.com/players');
     $crawler->filter('div.col ul li a')->each(function ($node) {
         $player = new Player();
         $name = explode('(', $node->text());
         $player->name = $name[0];
         $national = str_replace(')', '', $name[1]);
         $player->national = $national;
         $player->url = $node->attr('href');
         $player->save();
     });
     $players = Player::all();
     return view('players.list')->with(compact('players'));
 }
コード例 #20
0
ファイル: APIController.php プロジェクト: BobbyHoltzner/draft
 public function updatePlayers()
 {
     // We grab the league id that is entered by the user.
     $leagueId = getenv('LEAGUE_ID');
     $client = new Client();
     $res = $client->request('GET', 'http://football.myfantasyleague.com/2015/export?TYPE=players&L=' . $leagueId . '&W=&JSON=1');
     $players = $this->decodeMFL($res);
     foreach ($players as $player) {
         Player::create(['name' => $player->name, 'team' => $player->team, 'position' => $player->position, 'mflId' => $player->id]);
     }
     return 'Done!';
 }
コード例 #21
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request, Vote $votes)
 {
     $player1ID = Input::get('ddlPlayer1');
     $player2ID = Input::get('ddlPlayer2');
     $players_list = Player::orderby('last_name')->orderby('first_name')->get()->lists('last_first_name', 'player_id');
     $player1 = Player::where('player_id', '=', $player1ID)->first();
     $player2 = Player::where('player_id', '=', $player2ID)->first();
     $h2h = new Match();
     $head2head = $h2h->head2head($player1ID, $player2ID);
     $skills = Skill::orderby('skill_id')->get();
     $voter_id = \Auth::user()->id;
     return view('pages/matchups.show', compact('players_list', 'player1', 'player2', 'head2head', 'skills', 'votes', 'voter_id'));
 }
コード例 #22
0
ファイル: TestAddPoint.php プロジェクト: stefanledin/mmpingis
 public function test_player1_wins_first_set_and_player2_scores_takes_lead_in_second_set()
 {
     $player1 = Player::create(['points_set1' => 10]);
     $player2 = Player::create(['points_set1' => 9]);
     $match = Match::create(['set' => 1]);
     $match->players()->saveMany([$player1, $player2]);
     $player1->scored();
     $this->assertEquals(1, $match->set);
     $this->assertEquals(11, $player1->points());
     $this->assertEquals(9, $player2->points());
     $player2->scored();
     $this->assertEquals(2, $match->set);
     $this->assertEquals(0, $player1->points());
     $this->assertEquals(1, $player2->points());
 }
コード例 #23
0
ファイル: BaseController.php プロジェクト: kakitsubun/wc-test
 public function __construct()
 {
     // Always run csrf protection before the request when posting
     $this->beforeFilter(function () {
         $deviceId = Input::get('device_id');
         $playerId = Input::get('player_id');
         $player = Player::find($playerId);
         if (!$player || $player->device_id != $deviceId) {
             return 'Login Error';
         }
         $this->_player = $player;
         $this->_playerData = PlayerData::find($player->id);
     });
     // Here's something that happens after the request
     $this->afterFilter(function () {
         // something
     });
 }
コード例 #24
0
 /**
  * Insert new Match
  *
  * @param  array  $data
  * @return Participant
  */
 public function create_match(array $data)
 {
     $players = Player::select('player_id', 'first_name', 'last_name', \DB::raw('CONCAT(first_name, " ", last_name) as full_name'))->lists('player_id', 'full_name');
     //check to see if players exist in Players table
     $err = '';
     if (!array_key_exists($data['player1'], $players)) {
         $err .= '  Not in Players table: ' . $data['player1'];
     }
     if (!array_key_exists($data['player2'], $players)) {
         $err .= '  Not in Players table: ' . $data['player2'];
     }
     if ($err == '') {
         $player1_id = $players[$data['player1']];
         $player2_id = $players[$data['player2']];
         $match = \DB::table('matches')->where('tournament_id', '=', $data['tournament_id'])->where('player1_id', '=', $player1_id)->where('player2_id', '=', $player2_id)->first();
         if (is_null($match)) {
             $match = Match::create(['player1_id' => $player1_id, 'player2_id' => $player2_id, 'winner_id' => $player1_id, 'tournament_id' => $data['tournament_id'], 'match_date' => $data['match_date'], 'match_type' => $data['match_type'], 'match_division' => $data['match_division']]);
         }
     }
 }
コード例 #25
0
ファイル: Controller.php プロジェクト: AdrianKuriata/projekt
 public function __construct()
 {
     /*Licznik zmian, który zmienia się po 24h od dodania zmiany*/
     $date = Carbon::now();
     $date->modify('-24 hours');
     $formatted_date = $date->format('Y-m-d H:i:s');
     $countchange = Change::where('created_at', '>', $formatted_date)->count();
     /*Licznik graczy Online na serwerze*/
     $countonline = Player::where('online', '=', 1)->count();
     /*Licznik niedoczytanych wiadomości prywatnych*/
     $notread1 = Message::where('to_user_id', \Auth::id())->where('read', 0)->count();
     if (\Auth::check()) {
         Cache::remember('users', 5, function () {
             return User::where('id', \Auth::id())->update(['last_activity' => Carbon::now()]);
         });
     }
     /*Licznik i skrypt usuwający i nadający banicję za 4 ostrzeżenia na stronie*/
     $countcautions = Caution::where('user_id', \Auth::id())->count();
     if (!\Auth::guest() && $countcautions == 4) {
         $user = User::where('id', \Auth::id())->first();
         $g = array(4);
         $user->update(['banned' => 'Zbanowany za 4 ostrzeżenia na stronie']);
         $user->group()->sync($g);
     }
     $deleteCaution = Caution::where('user_id', \Auth::id())->where('created_at', '<=', Carbon::now()->subDays(14));
     $deleteCaution->delete();
     $section = Section::lists('name', 'id');
     $lives = Live::latest('created_at')->take(5)->get();
     if (!\Auth::guest()) {
         $notifications = \Auth::user()->notification()->latest('created_at')->take(10)->get();
         View::share('notifications', $notifications);
     }
     View::share('countchange', $countchange);
     View::share('countonline', $countonline);
     View::share('notread1', $notread1);
     View::share('section', $section);
     View::share('lives', $lives);
     $this->middleware('banned', ['except' => ['auth']]);
 }
コード例 #26
0
 /**
  * Web测试首页
  */
 public function index()
 {
     $intPlayerId = $this->_intPlayerId;
     $strDeviceId = $this->_strDeviceId;
     $objPlayer = Player::find($intPlayerId);
     echo "Game Index<br />";
     if (!$intPlayerId || $intPlayerId == 0) {
         echo "无PlayerID<br />";
     } else {
         if (!$objPlayer) {
             echo "无用户数据<br />";
             echo "<a href='/game/player/create?device_id=" . $strDeviceId . "'>新建玩家</a><br />";
             //        } else if (!$strDeviceId || $strDeviceId == "") {
             //            echo "无终端ID<br />";
             //        } else if ($objPlayer->device_id != $strDeviceId) {
             //            echo "玩家DeviceId不正确<br />";
         } else {
             echo "<a href='/game/player?player_id=" . $intPlayerId . "&device_id=" . $strDeviceId . "'>玩家情报</a><br />";
             echo "<a href='/game/battle?player_id=" . $intPlayerId . "&device_id=" . $strDeviceId . "'>战斗情报</a><br />";
             echo "<a href='/game/dungeon?player_id=" . $intPlayerId . "&device_id=" . $strDeviceId . "'>地下城探险开始</a><br />";
         }
     }
 }
コード例 #27
0
ファイル: GameState.php プロジェクト: KyleLehtinen/Meme-Slam
 public static function getGameState($match_id, $player_id)
 {
     //get match
     $match = Matches::find($match_id);
     //get player's opponent id
     $opponent_id = Matches::getOpponentID($match_id, $player_id);
     //get the player's state
     $player = Player::getPlayerState($match_id, $player_id);
     //get the opponent player's state
     $opponent = Player::getPlayerState($match_id, $opponent_id);
     //get the game's current state
     $match_state = $match->match_state;
     //get the current active player
     $active_player = $match->active_player_id;
     //get mogs for results animation screen
     $round_result_mogs = PlayField::getResultsAnimationMogs($match_id);
     //get last update timestamp
     $last_update = $match->updated_at;
     $last_update = substr($last_update, 0, 19);
     //create new game_state object
     $game_state = new GameState($player, $opponent, $match_state, $active_player, $round_result_mogs, $last_update);
     return $game_state;
 }
コード例 #28
0
ファイル: PlayersController.php プロジェクト: kbiyo/ARTTv2
 public function PostPlayerEmail(Request $request, $id)
 {
     $player = Player::find($id);
     $iid = $request->input('id');
     $nom = $request->input('nom');
     $prenom = $request->input('prenom');
     $email = $request->input('email');
     $errors = array();
     if ($player->id != $iid) {
         array_push($errors, 'Une erreur est survenue lors de la mise à jour de l\'email.');
     }
     if ($player->nom != $nom || $player->prenom != $prenom) {
         array_push($errors, 'Une erreur est survenue lors de la mise à jour de l\'email.');
     }
     if (count($errors) == 0) {
         $player->email = $email;
         $player->save();
         Session::flash('success', 'L\'adresse email de ' . $prenom . ' ' . $nom . ' a bien été modifiée.');
         return redirect()->route('AdmBatchsPlayers');
     }
     Session::flash('errors', $errors);
     return redirect()->route('AdmBatchsPlayers');
 }
コード例 #29
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $level = $request->input('level');
     $gender = $request->input('gender');
     $player_id = $request->input('player_id');
     $firstname = $request->input('firstname');
     $lastname = $request->input('lastname');
     //grid
     $players = \DB::table('players')->orderby('last_name')->orderby('first_name');
     //dropdown list
     $players_list = Player::orderby('last_name')->orderby('first_name')->get();
     $players_list = $players_list->lists('last_first_name', 'player_id');
     //Filters
     if (isset($gender)) {
         if ($gender != 'All') {
             $players = $players->where('gender', '=', $gender);
         }
     }
     if (isset($level)) {
         if ($level != 'All') {
             $players = $players->where('skill_level', '=', $level);
         }
     }
     if (isset($player_id)) {
         $players = $players->where('player_id', '=', $player_id);
     } else {
         if (isset($firstname)) {
             $players = $players->where('first_name', 'like', "%{$firstname}%");
         }
         if (isset($lastname)) {
             $players = $players->where('last_name', 'like', "%{$lastname}%");
         }
     }
     //Grid Paging
     $players = $players->paginate(5);
     return view('pages/players/index', compact('players', 'players_list', 'player_id', 'level', 'gender'));
 }
コード例 #30
0
 /**
  * List all Players registered in the system
  * @return [type] [description]
  */
 public function listPlayers()
 {
     $players_list = Player::orderby('last_name')->orderby('first_name')->get();
     $players_list = $players_list->lists('last_first_name', 'player_id');
     return $players_list;
 }