title: SQL query conversion to laravel query building
body: <p>I am new in laravel 5 sql query building and I face a challenge of converting sql to laravel 5.x sql query.</p>
  
  <p>Below is the normal sql:</p>
  
  <pre><code>select users.name as name, count(ticket.id) as total, sum(ticket.quantity * ticket.amount) as montant 
  from users 
  inner join program on program.driver_id = users.id
  inner join line on line.id = program.line_id
  inner join trip on trip.program_id = program.id
  inner join ticket  on ticket.trip_id = trip.id
  where program.date = $date
  group by users.name
  </code></pre>
  
  <p>which give me the response I need.
  but the laravel version of my code returns nothing. Below is my code</p>
  
  <pre><code>$result = \DB::table('users')
                  -&gt;select('users.name as name', \DB::raw('count(ticket.id) as total'),\DB::raw('SUM(ticket.quantity*ticket.amount) as montant'))
                  -&gt;Join('program', 'program.driver_id', '=', 'users.id')
                  -&gt;Join('line', 'line.id', '=', 'program.line_id')
                  -&gt;Join('trip', 'trip.program_id', '=', 'program.id')
                  -&gt;Join('ticket', 'trip.id', '=', 'ticket.trip_id')
                  -&gt;where('program.date', $date)
                  -&gt;groupBy('users.name')
                  -&gt;get();
  </code></pre>
  
  <p>Thanks in advance</p>