示例#1
0
 public function show($id)
 {
     $game = Game::with('playthroughs', 'playthroughs.players')->find($id);
     $bgg = new \App\Bgg();
     $api = $bgg->getBoardGame($game->bgg_id);
     return view('game.show', ['game' => $game, 'details' => $api]);
 }
示例#2
0
 public static function getPreviousWinner()
 {
     $game = Game::with('winner')->where('status', Game::STATUS_FINISHED)->orderBy('created_at', 'desc')->first();
     $winner = null;
     if (!is_null($game)) {
         $winner = ['user' => $game->winner, 'price' => $game->price, 'chance' => self::_getUserChanceOfGame($game->winner, $game)];
     }
     return $winner;
 }
示例#3
0
 public function game($gameId)
 {
     if (isset($gameId) && Game::where('status', Game::STATUS_FINISHED)->where('id', $gameId)->count()) {
         $game = Game::with(['winner'])->where('status', Game::STATUS_FINISHED)->where('id', $gameId)->first();
         $game->ticket = floor($game->rand_number * ($game->price * 100));
         $bets = $game->bets()->with(['user', 'game'])->get()->sortByDesc('created_at');
         $chances = [];
         $percents = $this->_getChancesOfGame($game, true);
         return view('pages.game', compact('game', 'bets', 'chances', 'percents'));
     }
     return redirect()->route('index');
 }
示例#4
0
 /**
  * List all games.
  *
  * @return Response
  */
 public function index()
 {
     $game = Game::with('Scores')->get();
     $this->tpl['games'] = $game;
     return view('game.list', $this->tpl);
 }