async index({ params: { users_id }, request, response }) {
    try {
      const { game_id, game_id_2, page } = request.all();
      const allBets = await Bet.query()
        .where("user_id", users_id)
        .with("game")
        .paginate(page, 10);
      const bets = !!game_id
        ? await Bet.query()
            .where("user_id", users_id)
            .where("game_id", game_id)
            .orWhere("game_id", game_id_2)
            .with("game")
            .fetch()
        : allBets;
      return bets;
    } catch (err) {
      return response.status(err.status).send({
        error: { message: "Algo não deu certo" },
      });
    }
  }
/**
   * Show a list of all bets.
   * GET bets
   */
Show a list of all bets.
GET bets
Show a list of all bets . GET bets
async index({ params: { users_id }, request, response }) {
    try {
      const { game_id, game_id_2, page } = request.all();
      const allBets = await Bet.query()
        .where("user_id", users_id)
        .with("game")
        .paginate(page, 10);
      const bets = !!game_id
        ? await Bet.query()
            .where("user_id", users_id)
            .where("game_id", game_id)
            .orWhere("game_id", game_id_2)
            .with("game")
            .fetch()
        : allBets;
      return bets;
    } catch (err) {
      return response.status(err.status).send({
        error: { message: "Algo não deu certo" },
      });
    }
  }
async index ( { params : { users_id } , request , response } ) { try { const { game_id , game_id_2 , page } = request . all ( ) ; const allBets = await Bet . query ( ) . where ( "user_id" , users_id ) . with ( "game" ) . paginate ( page , 10 ) ; const bets = ! ! game_id ? await Bet . query ( ) . where ( "user_id" , users_id ) . where ( "game_id" , game_id ) . orWhere ( "game_id" , game_id_2 ) . with ( "game" ) . fetch ( ) : allBets ; return bets ; } catch ( err ) { return response . status ( err . status ) . send ( { error : { message : "Algo não deu certo"  , } ) ; } }
Show a list of all bets.
Show a list of all bets .