From 1d3f69aa10eaebe4792ec09fd97e03506e317533 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Wed, 26 Nov 2025 15:44:42 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/CalendarsController.php | 2 +- app/Models/Calendar.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/CalendarsController.php b/app/Http/Controllers/Admin/CalendarsController.php index 7130029..1490dbf 100644 --- a/app/Http/Controllers/Admin/CalendarsController.php +++ b/app/Http/Controllers/Admin/CalendarsController.php @@ -50,7 +50,7 @@ class CalendarsController extends BaseController public function index() { $all = \request()->all(); - $list = Calendar::with('course', 'courseContent') + $list = Calendar::with('course', 'courseContent','historyCourses') ->where(function ($query) use ($all) { if (isset($all['month'])) { $query->where('start_time', 'like', $all['month'] . '%'); diff --git a/app/Models/Calendar.php b/app/Models/Calendar.php index 9cde227..2ddcef3 100755 --- a/app/Models/Calendar.php +++ b/app/Models/Calendar.php @@ -44,7 +44,7 @@ class Calendar extends SoftDeletesModel public function historyCourses() { - return $this->hasMany(HistoryCourse::class, 'calendar_id', 'id'); + return $this->hasOne(HistoryCourse::class, 'calendar_id', 'id'); } }