title: Laravel Queries
body: <p>I have 2 tables <strong>items</strong> and <strong>branch_item</strong>
  <br>I need to optimize and query this,</p>
  
  <pre><code>$test2 = DB::table('items')
              -&gt;join('branch_item', 'items.id', '=', 'branch_item.item_id')
              -&gt;select('items.minimum', 'branch_item.item_quantity')
              -&gt;where('branch_item.branch_id',9)
              -&gt;where('branch_item.item_quantity','&lt;' ,'items.minimum')
              -&gt;get();
  return $test2;
  </code></pre>
  
  <p>What I need is to query the items that is below in minimum in quantity of certain branch.</p>
  
  <p>I can do this using foreach but it loads so slow so I think I need to use join tables.</p>