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'); } }