title: Delete Method in Axios, Laravel and VueJS
body: <p>I am trying to send a delete request via axios to laravel as follow:</p>
  <pre><code>axios.delete('api/users/' + this.checkedNames)
  .then((response) =&gt; {
      console.log(response)
  }, (error) =&gt; {
      // error callback
  })
  </code></pre>
  <p>Now from axios documentation I read that for delete request we should be using  a configObject so the above could be rewritten as so:</p>
  <pre><code>axios.delete('api/users/', {params: {ids:     
      this.checkedNames})
  .then((response) =&gt; {
      console.log(response)
  }, (error) =&gt; {
      // error callback
  })
  </code></pre>
  <p>I have then <code>Route::resource('users', 'UsersController');</code> in api.php so the default route for deleting is:</p>
  <pre><code>DELETE| api/users/{user}| users.destroy 
  </code></pre>
  <p>and the controller's method is:</p>
  <pre><code>|App\Http\Controllers\UsersController@destroy
  </code></pre>
  <p>I am able to delete as expected a user when I pass a single id let's say api/users/12, it gets deleted correctly but when I try to pass the array above things get complicated.</p>
  <p>if I try as per axios documentation <code>axios.delete('api/users/', {params: {id: this.checkedNames}})</code> it looks I am sending this <code>http://lorillacrud.dev/api/users?id[]=21&amp;id[]=20</code> but I get a 405 method not allowed.</p>
  <p>if I try <code>axios.delete('api/users/' + this.checkedNames )</code> I get <code>http://lorillacrud.dev/api/users/20,21</code> so in my destroy method I could grab the ids and delete, but I am wondering if this is the correct way to do it?</p>
  <h1>update</h1>
  <p>I seemed I made it work but I am not understanding so any help still appreciated to make a sense of what I am actually making work!</p>
  <p>So, if change to:</p>
  <pre><code>axios.delete('api/users/destroy', {params: {'id': this.checkedNames})
  </code></pre>
  <p>and in my destroy method:</p>
  <pre><code>    if ($request-&gt;id) {
          foreach ($request-&gt;id as $id) {
              User::destroy($id);
          }
      }
      User::destroy($id);
  }
  </code></pre>
  <p>So...</p>
  <pre><code>// not deletes the user
  axios.delete('api/users/destroy', {params: {id: id}}) 
  
  // ok deletes the users when using request-&gt;id in a for loop in the destroy laravel method.
  axios.delete('api/users/destroy', {params: {ids: this.checkedNames}}) 
  
  // ok deletes one user
  axios.delete('api/users/' + id)
  </code></pre>
  <p>sorry guys but I have a lot of confusion why and what !!!</p>
  <p>The route name is <code>user.destroy</code> why does it work when I pass an array and it does not when I pass a single value, why viceversa the route with method delete will not delete when pass an array ???</p>
  <p>Any difference between using <code>api/users/destroy</code> vs <code>api/users</code> only?</p>
  <p>Thanks for any help on this!</p>