$rating = User::query()
->join('championship_sessions', 'users.id', '=', 'championship_sessions.user_id')
->whereBetween('championship_sessions.created_at', [
$activeChampionship['data']['start_time'],
$activeChampionship['data']['end_time'],
])
->where('championship_sessions.status', '=', 1)
->groupBy('users.id')
->orderBy('users.rating', 'desc')
->select(['users.id', 'users.name', DB::raw('COUNT(championship_sessions.status) as rating'), 'users.status_name', 'users.status_id'])
->paginate(100)->toArray();