public function buyTicketsforBowler($leagueId, $lotteryId) { $isValidToken = User::checkAuth(); $postedData = file_get_contents("php://input"); $postedData = substr($postedData, 2, -2); $bowlerID = explode(':', $postedData)[1]; if ($isValidToken != 0) { $buyticket = Lottery::buyticketofLeague($leagueId, $lotteryId, $bowlerID); if ($buyticket == 0) { return json_encode("Invalid Bowler ID / League ID / Lottery ID"); } if (empty($buyticket)) { return json_encode("Invalid Bowler ID / League ID / Lottery ID"); } return \Response::json($buyticket, 200); } else { return json_encode("Please enter valid Authentication Token"); } }