master
cody 2 weeks ago
parent 053888afe4
commit 1d3f69aa10

@ -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'] . '%');

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

Loading…
Cancel
Save