Exemplo n.º 1
0
 public function buyticket()
 {
     $lottery_id = $_GET['lottery_id'];
     $baseURL = '../../public/';
     $user = Auth::user()->id;
     $checkTicket = Lottery::checkBuyTicket($lottery_id, $user);
     if (empty($checkTicket)) {
         Lottery::buyLotteryTicket($lottery_id, $user);
     } else {
         Lottery::buyticket($lottery_id, $user);
     }
     $currentLotteryJackpot = Lottery::getCurrentJackpot($lottery_id);
 }
Exemplo n.º 2
0
 public function recordResultforRoll($leagueId, $lotteryId)
 {
     $isValidToken = User::checkAuth();
     $postedData = file_get_contents("php://input");
     $postedData = substr($postedData, 2, -2);
     $pinCount = explode(':', $postedData)[1];
     $jackpotAmount = Lottery::getCurrentJackpot($lotteryId);
     if ($isValidToken != 0) {
         $bowlerId = $isValidToken[0]->id;
         if ($pinCount == 10) {
             $winnerAmount = $jackpotAmount[0]->balence;
             $jackpot = Lottery::getstrike($lotteryId, $bowlerId, $winnerAmount);
             return \Response::json($jackpot, 200);
         } else {
             $winnerAmount = $jackpotAmount[0]->balence / 10;
             $jackpot = Lottery::getnonstrike($lotteryId, $bowlerId, $winnerAmount, $pinCount[0]);
             return \Response::json($jackpot, 200);
         }
     } else {
         return json_encode("Please enter valid Authentication Token");
     }
 }