mardi 27 juillet 2021

Data getting saved as null string in db

I am passing data from vue.js

formData.append('remark', this.form.remark);

 <textarea v-model="form.remark" class="form-control"> </textarea>

  mounted(){ 
                  
          const header = {
            'Authorization' : 'Bearer ' + this.getLoginUserData,
          }
         this.editId = this.$route.params.id;
         axios.get(`/api/backend/userdata/${this.editId}` , {headers : header})
         .then((response) => {   
            this.form = response.data;

form initialization :

form: {
                name: '',
                remark: '',

In my controller i'm getting null string and it is getting saved in database column. so i have to check it manually in my laravel controller to check for null string and if that string is saved in my database then it reflect in textfield also.

if($request->remark == "null")
      {
        $save->remark = "";
      }

But i don't want to check it manually everytime for null string. Any solution will be highly appreciated.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3i7QcmS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire