Make a query with laravel with the following logic

0

Hello friends of the community. I need to fill a chart but I can not mount the query to receive the attributes, could anyone help me? The query I need to do is the following.

select client.name, count(*) as Tickets 
from client, ticket 
where client.id = ticket.client_id 
group by client.id
    
asked by anonymous 29.07.2016 / 13:51

1 answer

1

You can try:

use DB;
...
$dados = DB::select('select client.name, count(*) as Tickets 
from client, ticket 
where client.id = ticket.client_id 
group by client.id');
    
29.07.2016 / 13:55