Laravel クエリ:
$studentsFee = \FeeModal::query();
$studentsFee->groupBy('main_campus_id', 'session_id', 'class_info_id', 'section_id', 'stage_id')
->selectRaw('count(student_id) as student_strength,SUM(IF(paid_amount>0,1,0)) as submit_students,SUM(IF(paid_amount=0,1,0)) as not_submit_students, sum(paid_amount) as submit_amount')
->with('sessionMode', 'section', 'classInfo', 'stage')->get();
dd(count($studentsFee). ' Records' );
結果: 0 レコード
によって生成されたクエリ->toSql();
string(281) "select count(student_id) as student_strength,SUM(IF(paid_amount>0,1,0)) as submit_students,SUM(IF(paid_amount=0,1,0)) as not_submit_students, sum(paid_amount) as submit_amount from `fee` group by `main_campus_id`, `session_id`, `class_info_id`, `section_id`, `stage_id`"
mysqlでこのクエリを実行すると、18行が返されます。