title: How to use Belongs table in select
body: <p>In laravel5 i belongsTo a model in a model that is</p>
  
  <pre><code> public function LeaveCategories()
  {
      return $this-&gt;belongsTo('App\LeaveCategories','leave_category_id','id');
  }
  </code></pre>
  
  <p>Then i query in a controller that is </p>
  
  <pre><code>$userInfo = Leave::select(DB::raw('count(leaves.leave_category_id) as category_used'),
          'LeaveCategories.id','LeaveCategories.category','LeaveCategories.category_num')
          -&gt;where('Leaves.leave_date','&gt;=', $first_day_this_year)
          -&gt;where('Leaves.leave_date','&lt;=', $last_day_this_year)
          -&gt;where('Leaves.leave_status', 1)
          -&gt;groupBy('Leaves.leave_category_id','LeaveCategories.category','LeaveCategories.category_num','LeaveCategories.id')
          -&gt;get();
  </code></pre>
  
  <p>But it shows a error that is Unknown column 'LeaveCategories.id' in 'field list' </p>