传递给Illuminate \ Database \ Grammar :: parameterize()的参数1必须为数组类型

时间:2019-10-28 02:06:05

标签: php laravel axios

这很好奇,因为当我向邮递员注册时,结果与预期的一样,但是在由axios执行请求时却不起作用

传递给Illuminate \ Database \ Grammar :: parameterize()的参数1必须为int类型的数组,在D:\ Documentos \ Git \ SIGEME \ vendor \ laravel \ framework \ src \ Illuminate \ Database \中调用869行上的Query \ Grammars \ Grammar.php

Laravel函数

 public function store(Request $request)
    {
        try {
            //$form = new Form();
            $form = new Form([$doc =  $request->input('loinc_doc')]);
            $form->loinc_doc = $doc;
            $form->user_id = User::where('user', $request->user_name)->first()->id;
            $form->user_make_id = User::where('user', $request->user_make_name)->first()->id;
            $form->user_sign_id = User::where('user', $request->user_sign_name)->first()->id;
            //return var_dump($form->getAttributes());
            $form->save();

            $formsPatients = new FormsPatients();
            $formsPatients->patient_id = intval($request->patient_id);
            $formsPatients->form_id = $form->id;
            //return var_dump($formsPatients->getAttributes());
            $formsPatients->save();

            return response('Posted!', 200);
        } catch (\Exception $e) {
            return response('Something go bad! ' . $e->getMessage(), 300);
        }
    }

AXIOS功能

 addForm: function() {
      this.data = LForms.Util.getUserData(formulario, true, true, true);
      this.merge = LForms.Util.mergeFHIRDataIntoLForms(
        "QuestionnaireResponse",
        this.data,
        this.defForm,
        "R4"
      );
      let data = {
        loinc_doc: this.merge,
        user_name: sessionStorage.userName,
        user_make_name: sessionStorage.userName,
        user_sign_name: sessionStorage.userName,
        patient_id: this.idPatient
      };
      let headers = {
        headers: {
          Authorization: "Bearer " + sessionStorage.Token
        }
      };
      axios
        .post("/forms/", data, headers)
        .then(function(response) {
          console.log(response);
        })
        .catch(function(error) {
          console.log(error);
        })
        .finally(function() {
          // always executed
        });
    }

0 个答案:

没有答案