title: sum of columns in another table - laravel
body: <p>There's a loan table and loan_addition table. How can I sum the added_amt of loan_addition table and show them while returning loan table data?
  loan_addition table</p>
  <pre><code>id   loan_id   added_amt
  1       1        100
  2       1        200 
  </code></pre>
  <p>controller</p>
  <pre><code>$data = Loan::select('*')
  -&gt;with('loanAddition') // how to sum all the columns of respective loan_id here
  -&gt;get();
  dd($data);
  </code></pre>
  <p>loan model</p>
  <pre><code>class Loan extends Model
  {
      public function loanAddition() {
          return $this-&gt;hasMany(LoanAddition::class);
      }
  }
  </code></pre>
  <p>LoanAddition model</p>
  <pre><code>class LoanAddition extends Model
  {
      public function loan()
      {  return $this-&gt;belongsTo(Loan::class);  }
  }
  </code></pre>
  <p>Thanks in advance..</p>