title: filter and field on array collection in laravel
body: <p>In this array collection, I want to filter only those array elements that are due. How can I use a filter query on an array collection? </p>
  
  <pre><code>  0 =&gt; array:7 [
      "semester" =&gt; "1"
      "fee_head" =&gt; "4"
      "fee_due_date" =&gt; "2018-04-07 00:00:00"
      "fee_amount" =&gt; 18000
      "discount" =&gt; 0
      "fine" =&gt; 0
      "paid_amount" =&gt; 1200
    ]
    1 =&gt; array:7 [
      "semester" =&gt; "1"
      "fee_head" =&gt; "4"
      "fee_due_date" =&gt; "2018-04-07 00:00:00"
      "fee_amount" =&gt; 18000
      "discount" =&gt; 0
      "fine" =&gt; 0
      "paid_amount" =&gt; 18000
    ]
  </code></pre>
  
  <p><strong>Calculating Due:</strong> 
  $due = (fee_amount - (discount+paid_amount))+fine
  if($due>0) 
  then I want to get following output</p>
  
  <pre><code>0 =&gt; array:7 [
              "semester" =&gt; "1"
              "fee_head" =&gt; "4"
              "fee_due_date" =&gt; "2018-04-07 00:00:00"
              "fee_amount" =&gt; 1800
              "discount" =&gt; 0
              "fine" =&gt; 0
              "paid_amount" =&gt; 1200
               "due"  =&gt; 600
        ]
  </code></pre>