title: Laravel | Special validation of a lot of data
body: <h1>Validation of a data (1 - 10000 possible rows)</h1>
  <p>So to give some context I am creating a web based mapping interface to map other data formats to our format.</p>
  <h2>Problem</h2>
  <p>Taking an array of data and an array of formats like this:</p>
  <pre><code>$vehicle = [
      'cost' =&gt; '$159',
      'reconditioning' =&gt; '$140'
  ];
  
  $formats = [
      'cost' =&gt; 'integer',
      'reconditioning' =&gt; 'integer'
  ];
  </code></pre>
  <p>And checking all of the fields for inconsistencies with our data structure, like &quot;total_cost&quot; would be an error in the data since it has a non-numeric character in it. The output of the validation would have to show an error for each individual field like shown below (true meaning that that field has an error):</p>
  <pre><code>$vehicle_errors = [
      'total_cost' =&gt; true, 
      're_condition' =&gt; true
  ];
  </code></pre>
  <p>Which after the validation, I am displaying the fields that had errors for the user to correct them.</p>
  <p>I have succeeded in doing all of this but I was using for-loops and a switch case to validate each individual field, this becomes a problem when we get more than a few thousand vehicles.</p>
  <h2>What I've Tried</h2>
  <p>I have tried using for-loops to accomplish this with success but php required me to increase the &quot;max_input_vars&quot; to a lot which I would like to try to avoid because this operation heavily taxed my server.
  I have also tried Laravels validation which didnt give me the output I wanted and also had the same problem as using for-loops did, with the php error.</p>
  <h2>Possible Solutions</h2>
  <p>I know that there is a way to validate data in a mysql table and get an output similar to what I need, this would fix my problem due to it using the mysql servers resources but I do not have any idea of how to accomplish this and couldn't find anything online about this topic.</p>