title: Laravel - Return multiple values within one method
body: <p>Heres where I'm currently stuck at. I am doing multiple methods where I am doing the different queries to the same table:</p>
  
  <pre><code>public function totalOfA()
  {
      return $a = Stocks::where('user_id','=', $this-&gt;employee-&gt;id)
          -&gt;where('category','=','a')
          -&gt;pluck('qty')
          -&gt;sum();
  }
  
  public function totalOfB()
  {
      return $a = Stocks::where('user_id','=', $this-&gt;employee-&gt;id)
          -&gt;where('category','=','a')
          -&gt;pluck('qty')
          -&gt;sum();
  }
  </code></pre>
  
  <p>I'm trying to look for a way to sum that all up to just one function</p>
  
  <pre><code>public function totalStocks()
  {
      $stocks = Stocks::where('user_id','=', $this-&gt;employee-&gt;id)
          -&gt;get();
  
      $a = $stocks::where('category', '=', 'a')
          -&gt;pluck('qty')
          -&gt;sum();
  
      $b = $stocks::where('category', '=', 'b')
          -&gt;pluck('qty')
          -&gt;sum();
  
      return $a and $b
  }
  </code></pre>
  
  <p>So I can just call it from view as totalstocks()->a or totalstocks()->b something like that.</p>