title: Laravel selectRaw with joined table data
body: <p>I am using the following to sum a total column:</p>
  
  <pre><code>$hive_count = Hive::where('active','true')
                        -&gt;groupBy('hive_type_id')
                        -&gt;selectRaw('sum(total) as sum, hive_type_id')
                        -&gt;pluck('sum','hive_type_id');
  </code></pre>
  
  <p>But rather than using the hive_type_id for the array key, I would like to access the hive_type name from the hive_types table (column 'name'). I have tried hive_type_id.name but this did not work.</p>
  
  <p>Models: Hive &amp; HiveType</p>
  
  <p>Thanks for your help.</p>