title: I'm having trouble with "AXIOS PATCH" method
body: <p>I am trying to update my database record using "axios patch" method.</p>
  
  <p>This is my code:</p>
  
  <pre><code>editClient(client) {
    let data = new FormData();
    data.append("name", this.client.name);
    data.append("email", this.client.email);
    data.append("phone", this.client.phone);
    data.append("_method", "PATCH");
    axios
      .post(`/api/clients/${client.id}`, data)
      .then(res =&gt; {
        resolve(res.data.client);
      })
      .catch(err =&gt; console.log(err.response.data));
  },
  </code></pre>
  
  <p>I tried this code:</p>
  
  <pre><code>axios
      .patch(`/api/clients/${client.id}`, {
        name: this.client.name,
        phone: this.client.phone,
        email: this.client.email
      })
      .then(res =&gt; {
        resolve(res.data.client);
      })
      .catch(err =&gt; console.log(err.response.data));
  </code></pre>
  
  <p>But it also dosn't work.</p>
  
  <p>The error i get is </p>
  
  <blockquote>
    <p>POST <a href="http://localhost:8000/api/clients/27" rel="nofollow noreferrer">http://localhost:8000/api/clients/27</a> 500 (Internal Server Error)</p>
  </blockquote>
  
  <pre><code>{message: "SQLSTATE[42S22]: Column not found: 1054 Unknown co…4 02:12:57"` = updated_at:"2019-05-24 02:12:57"})", exception: "Illuminate\Database\QueryException", file: "C:\xampp\htdocs\prs3\vendor\laravel\framework\src\Illuminate\Database\Connection.php", line: 664, trace: Array(60)}
  exception: "Illuminate\Database\QueryException"
  file: "C:\xampp\htdocs\prs3\vendor\laravel\framework\src\Illuminate\Database\Connection.php"
  line: 664
  message: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name:"2011"' in 'where clause'
  </code></pre>
  
  <p>And when I tried this code: </p>
  
  <pre><code>axios
      .patch(`/api/clients/${client.id}`, {
        data: this.client
      })
      .then(res =&gt; {
        resolve(res.data.client);
      })
      .catch(err =&gt; console.log(err.response.data));
  </code></pre>
  
  <p>The error i get is </p>
  
  <blockquote>
    <p>app.js:285 PATCH <a href="http://localhost:8000/api/clients/27" rel="nofollow noreferrer">http://localhost:8000/api/clients/27</a> 422 (Unprocessable Entity)</p>
  </blockquote>
  
  <pre><code>{message: "The given data was invalid.", errors: {…}}
  errors:
  email: ["The email field is required."]
  name: ["The name field is required."]
  phone: ["The phone field is required."]
  __proto__: Object
  message: "The given data was invalid."
  </code></pre>
  
  <p>Im new in axios and vue. Im trying to learn on how to build and CRUD api using axios.</p>
  
  <p>I tried to find other ways and i can't find any.</p>
  
  <p>This is my controller:</p>
  
  <pre><code>public function update(Client $client) {
          $val = $client ? ','.$client : '';
          $client-&gt;update($this-&gt;_val($val));
          return back();
      }
  
      public function _val($val) {
          return request()-&gt;validate([
              'name' =&gt; ['required', 'min:2', 'unique:clients,name'.$val],
              'email' =&gt; ['required', 'email', 'unique:clients,email'.$val],
              'phone' =&gt; ['required', 'alpha_num'],
          ]);
      }
  </code></pre>