diff --git a/app/Http/Controllers/Admin/OtherController.php b/app/Http/Controllers/Admin/OtherController.php index ae9ef0f..7430581 100755 --- a/app/Http/Controllers/Admin/OtherController.php +++ b/app/Http/Controllers/Admin/OtherController.php @@ -145,7 +145,9 @@ class OtherController extends CommonController ->where('start_time', 'like', '%' . date('Y-m') . '%') ->get(); // 课程统计 - $courseTypes = CourseType::where('is_chart', 1)->where('is_history', 0)->get(); + $courseTypes = CourseType::where('is_chart', 1) + ->orderBy('sort', 'asc') + ->where('is_history', 0)->get(); // 默认开始时间 $start_date = CourseType::START_DATE; // 默认结束日期一年以后 diff --git a/database/migrations/2025_11_29_211450_add_sort_to_course_types_table.php b/database/migrations/2025_11_29_211450_add_sort_to_course_types_table.php new file mode 100644 index 0000000..d114c59 --- /dev/null +++ b/database/migrations/2025_11_29_211450_add_sort_to_course_types_table.php @@ -0,0 +1,32 @@ +integer('sort')->default(1)->comment('排序'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('course_types', function (Blueprint $table) { + $table->dropColumn('sort'); + }); + } +};