\DB::table('users')->where('users.id', $user_id)
->leftJoin('users as u2', function ($join) {
$join->on('u2.rating', '>', 'users.rating')
->orOn(function ($query) {
$query->whereRaw('u2.rating = users.rating')
->whereRaw('u2.id <= users.id');
});
})->count();
padding: 40px, 20px;
padding: 40px 20px;