From fde517f253796133299ae5ef784d0ae32c2f18c5 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Sat, 29 Nov 2025 21:16:07 +0800 Subject: [PATCH] update --- .../Controllers/Admin/OtherController.php | 4 ++- ..._211450_add_sort_to_course_types_table.php | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2025_11_29_211450_add_sort_to_course_types_table.php 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'); + }); + } +};