first
This commit is contained in:
@@ -40,11 +40,16 @@ class ParticipantController extends Controller
|
||||
|
||||
$programParticipants = $query->paginate(20)->withQueryString();
|
||||
|
||||
$countRow = DB::table('program_participants')
|
||||
->where('program_id', $program->id)
|
||||
->selectRaw("COUNT(*) as total, SUM(is_pre_registered) as pre_registered, SUM(registration_source = 'walk_in') as walk_in, SUM(status = 'checked_in') as checked_in")
|
||||
->first();
|
||||
|
||||
$counts = [
|
||||
'total' => $program->programParticipants()->count(),
|
||||
'pre_registered' => $program->programParticipants()->where('is_pre_registered', true)->count(),
|
||||
'walk_in' => $program->programParticipants()->where('registration_source', 'walk_in')->count(),
|
||||
'checked_in' => $program->programParticipants()->where('status', 'checked_in')->count(),
|
||||
'total' => (int) ($countRow->total ?? 0),
|
||||
'pre_registered' => (int) ($countRow->pre_registered ?? 0),
|
||||
'walk_in' => (int) ($countRow->walk_in ?? 0),
|
||||
'checked_in' => (int) ($countRow->checked_in ?? 0),
|
||||
];
|
||||
|
||||
return view('admin.programs.participants.index', compact('program', 'programParticipants', 'counts'));
|
||||
|
||||
Reference in New Issue
Block a user