Passing checkbox true or false VueJS
09:07 02 May 2021

I have a checkbox on my VueJS site, I want to do the following: if the checkbox special is true, then send in database value 1 in column, how can I do this correctly?

I did like this:



data() {
    return {
      channel: "",
      special: false,
    }
    sendFunction() {
      this.$root.axios.post("/user/userPromo", {
        channel: this.channel,
        special: this.special
      }).then((res) => {
        const data = res.data;
        this.$root.showNotify(data.type, this.$t(`index.${data.message}`, {
          name: data.name
        }));
      });
    },

And in backend when i add data in table, i use $special = $r->get('special');, but it doesn't want to work. When is my mistake?

vue.js