title: How to dispatch a chained job in a loop?
body: <p>I am trying to dispatch a Laravel job inside a foreach loop. But the problem is, when I dispatch job inside loop sometimes it is completed before jobs queued before it are completed. What I want that is jobs should be completed one by one. Like happens in the chain method. But How I chain the same job inside the foreach loop? Is this possible?</p>
  <pre><code>foreach ($consignments as $consignment) {
       CalculateSingleConsignment::dispatch($consignment, $total_consignments, $i, $user_id, $notify)-&gt;onQueue('invoice');
       $i++;
  }
  </code></pre>