Again with my new questions, does anyone know how I can translate this query to eloquent?
SELECT COUNT(nombre), usuario_ad
FROM usuarios
GROUP BY usuario_ad
ORDER BY COUNT(nombre) desc;
Again with my new questions, does anyone know how I can translate this query to eloquent?
SELECT COUNT(nombre), usuario_ad
FROM usuarios
GROUP BY usuario_ad
ORDER BY COUNT(nombre) desc;
Solution!
DB::table('usuarios')
->select('usuario_ad', DB::raw('count(nombre) as nombre'))
->groupBy('usuario_ad')
->orderBy('nombre', 'desc')
->paginate(10);