Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
395 B
1
Indexable
Never
 $leaderboard =  DB::table('user_p_n_r_submissions')
            ->selectRaw('user_id,  CAST(SUM(user_point) as SIGNED ) as total_point',)
            ->where('status', PNRStatusEnum::VALID)
            ->whereBetween(DB::raw('DATE(created_at)'), array($from, $to))
            ->groupBy('user_id')
            ->orderBy('total_point', 'DESC')
            ->limit(50)
            ->get();