master
cody 2 weeks ago
parent 24df329c31
commit dfc6903893

@ -271,7 +271,14 @@ class OtherController extends CommonController
$courseTypes = CourseType::whereIn('id', $course_type_id)->get();
foreach ($courseTypes as $courseType) {
// 获取课程
$courses2 = Course::where('type', $courseType->id)->orderBy('start_date', 'asc')->get();
$courses2 = Course::where('type', $courseType->id)
->whereHas('course', function ($query) use ($start_date, $end_date) {
// 开始结束日期的筛选。or查询
if ($start_date && $end_date) {
$query->whereBetween('start_date', [$start_date, $end_date])
->orWhereBetween('end_date', [$start_date, $end_date]);
}
})->orderBy('start_date', 'asc')->get();
foreach ($courses2 as $course) {
$courseTypesSum[] = [
'course_type' => $courseType->name,

Loading…
Cancel
Save