Exemplo n.º 1
0
 public function lottery()
 {
     $baseURL = '../public/';
     $user = Auth::user();
     $currentJackpot;
     $allLeague = League::getAllLeagueID();
     $allLottery = Lottery::getActiveLotteryID();
     $is_bowler = User::isBolwer($user->id);
     foreach ($allLottery as $lottery) {
         foreach ($lottery as $lottery_id) {
             $currentLottery = Lottery::getCurentJackpotDetailsByLotteryId($lottery_id);
             foreach ($currentLottery as $lottery) {
                 $hasJoinedLeague = League::hasJoinedLeague($lottery->league_id, $user->id);
                 if (empty($hasJoinedLeague)) {
                     $is_joined_league = 0;
                 } else {
                     $is_joined_league = 1;
                 }
                 $usersInLeague = League::getUsersinLeague($lottery->league_id);
                 $currentJackpot[$lottery_id][] = ['data' => $lottery, 'is_joined_league' => $is_joined_league, 'current_user' => $user->id, 'usersInLeague' => $usersInLeague];
             }
         }
     }
     $pastLotteryResults = Lottery::getInactiveLotteryResults();
     if (empty($pastLotteryResults)) {
         $pastLottery = 0;
     }
     foreach ($pastLotteryResults as $lotteryResult) {
         $pastLottery[$lotteryResult->lottery_id][] = ['data' => $lotteryResult];
     }
     $pastLottery = array_reverse($pastLottery);
     $allLeagueID = League::getAllLeaguebyGroup();
     return \View::make('lottery')->with('currentJackpot', $currentJackpot)->with('pastLottery', $pastLottery)->with('allLeagueID', $allLeagueID)->with('is_bowler', $is_bowler)->with('baseURL', $baseURL);
 }