title: Laravel prepared statements UPDATE Query
body: <p>I'm trying to figure out how to update a database row but I want to prevent sql injection</p>
  
  <pre><code>$postdata = $request-&gt;except('token');
  $src = json_decode($postdata['data']);
  
  $locationData = addslashes ( $src-&gt;locationData );
  $userData = addslashes ( $src-&gt;userData );
  if ( isset($src-&gt;routeData) ){
      $routeData = addslashes ( $src-&gt;routeData );
  } else {
      $routeData = null;
  }
  $url = addslashes ( $src-&gt;url );
  
  DB::statement("UPDATE maps SET locationData = '$locationData', userData = '$userData', routeData = '$routeData' WHERE url = ?", [$url]);
  </code></pre>
  
  <p>I would be very greatful if someone were to show me in the above how to secure the query.</p>