📅  最后修改于: 2022-03-11 14:54:04.440000             🧑  作者: Mango
public function parent()
{
return $this->belongsTo('App\CourseModule','parent_id')->where('parent_id',0);
}
public function children()
{
return $this->hasMany('App\CourseModule','parent_id');
}