title: how to select particular user id in laravel?
body: <p>i have tried the below code to calculate the attendance of a particular user but calculations is happening for all the users available in the table. I'm new to laravel so i need help.</p>
  
  <p>in the controller: </p>
  
  <pre><code>  $TController =DB::table('tbl_attendancetime')
    -&gt;select('username','statusid','status_description','user_id')
    -&gt;groupby('username')
     -&gt;get();  
  
  $TController1 =DB::table('tbl_attendancetime')//-&gt;distinct() 
  -&gt;select('statusid')
  -&gt;where('statusid','=', 0)//-&gt;groupBy('user_id')
  -&gt;get();
  
  
  $TController2 =DB::table('tbl_attendancetime')
  -&gt;select('statusid')//-&gt;groupby('user_id')
  -&gt;where('statusid','=', 1)//-&gt;distinct()-&gt;get(array('user_id'));
  //-&gt;groupBy('user_id')
  -&gt;get();
  
  
  
  $TController3 =DB::table('tbl_attendancetime')
  -&gt;select('status_description')//-&gt;groupby('user_id')
  -&gt;where('status_description','=',3)
  -&gt;groupBy('user_id')
  -&gt;get();
  
  $TController4 =DB::table('tbl_attendancetime')
  
  -&gt;select(
   'status_description')//-&gt;groupby('user_id')
  -&gt;where('status_description','4')
  -&gt;groupBy('user_id')
  -&gt;get();
  
  $TController5 =DB::table('tbl_attendancetime')
  
   -&gt;select(
  'status_description')//-&gt;groupby('user_id')
  -&gt;where('status_description','5')
  -&gt;groupBy('user_id')
  -&gt;get();
  
  foreach($TController as $row)
  {
  
  $a=count($TController1);
  $p=count($TController2);
  $e=count($TController3);
  $s=count($TController4);
   $su=count($TController5);
  
  }
  </code></pre>