title: How to pass arrays from javascript to laravel controller using axios
body: <p>I'm using Laravel 5.4 and I'm handling my data with Vue 2. I'm Trying to call a controller method using axios, but I can't find a proper way to pass two arrays. I need to send them to my controller in order to make some database requests with them and get some data back.</p>
  <p>I've manage to pass the arrays as strings as shown below, however, I would prefer not to transform the strings to arrays on my controller.</p>
  <p>Could there be a way to do the same thing as I'm doing below but passing the arrays as arrays instead of strings or is this just not possible?</p>
  <p>Axios call on Vue:</p>
  <pre><code>$rutas = [&quot;01&quot;, &quot;02&quot;];
  $tipos = [&quot;01&quot;, &quot;03&quot;, &quot;04&quot;];
  
  var params = new URLSearchParams();
  params.append(&quot;rutas&quot;, $rutas);
  params.append(&quot;tipos&quot;, $tipos);
  
  var request = {
    params: params
  };
  axios.get('/test/', request);
  </code></pre>
  <p>This is my route</p>
  <pre><code>Route::get('/test/', 'TestsController@getClientesPorRuta');
  </code></pre>
  <p>This is my controller's method:</p>
  <pre><code>public function getClientesPorRuta(Request $request) {
    $rutas = $request-&gt;input('rutas');
    $tipos = $request-&gt;input('tipos');
    
    // Code like this doesn't work
    $index = 0;
    $register = Ruta::where('CODIRUTA','=',$rutas[$index])-&gt;first();
  }
  </code></pre>