title: Laravel DB Query issues caused by findOrFail in for loop
body: <p>My application processes thousands of database entries and allows the user to export a certain part of the search result list.</p>
  
  <p>Every <code>Entry</code> holds specific files and the user wants to download them in a compressed file (eg. zip). This works fine, but I am running most probably into <em>max execution timeouts</em>. I've tried for debugging reasons to simply adjust the <code>max_execution_time</code> for PHP at all and in my php script. Both did not omit the error.</p>
  
  <p>Basically I have two questions:</p>
  
  <ol>
  <li>How to analyse the problem correctly? (Does it have to do with the max execution time)</li>
  <li>How to omit max execution timeouts? (Most probably it is this, because with smaller amounts of queries it works just fine)</li>
  </ol>
  
  <p><em>Example code:</em></p>
  
  <pre><code>public function export(Requests\ExportRequest $request)
  {
      $input = $request-&gt;all();
  
      foreach ($input['entries'] as $id) {
          $entry = Entry::findOrFail($id);
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Fyi, the problem was not the <code>max_execution_time</code>, even it did reduce the SQL queries massively. The problem was caused by the limitation of <code>max_input_vars</code>. The targeted entries were checked in a form and send to the export() function. Every checkbox had <code>name=entries[]</code>, which caused that each entry had a seperate input value. You can read more about this problem here: <a href="https://stackoverflow.com/questions/18666104/is-there-a-limit-on-checked-checkboxes-in-php-form-post">Is there a limit on checked checkboxes in PHP form POST?</a> (Consider also reading this specific <a href="https://stackoverflow.com/questions/18666104/is-there-a-limit-on-checked-checkboxes-in-php-form-post#18667023">answer</a>)</p>