async index({ request, auth }) {
    const user = await auth.getUser();

    if (await user.can("read_private_property")) {
      const { latitude, longitude } = request.all();
      const { page } = request.get();

      const properties = Property.query()
        .with("images")
        .nearBy(latitude, longitude, 10)
        .paginate(page);

      return properties;
    }

    const properties = await Property.query()
      .where({ type: "public" })
      .fetch();
    return properties;
  }
/**
   * Show a list of all properties.
   * GET properties
   */
Show a list of all properties.
GET properties
Show a list of all properties . GET properties
async index({ request, auth }) {
    const user = await auth.getUser();
    if (await user.can("read_private_property")) {
      const { latitude, longitude } = request.all();
      const { page } = request.get();
      const properties = Property.query()
        .with("images")
        .nearBy(latitude, longitude, 10)
        .paginate(page);
      return properties;
    }
    const properties = await Property.query()
      .where({ type: "public" })
      .fetch();
    return properties;
  }
async index ( { request , auth } ) { const user = await auth . getUser ( ) ; if ( await user . can ( "read_private_property" ) ) { const { latitude , longitude } = request . all ( ) ; const { page } = request . get ( ) ; const properties = Property . query ( ) . with ( "images" ) . nearBy ( latitude , longitude , 10 ) . paginate ( page ) ; return properties ; } const properties = await Property . query ( ) . where ( { type : "public" } ) . fetch ( ) ; return properties ; }
Show a list of all properties.
Show a list of all properties .