📅  最后修改于: 2022-03-11 15:00:15.459000             🧑  作者: Mango
$result->whereHas('student', function($q) use($search){
$q->where('name','LIKE','%'.$search.'%');
})->orWhereHas('room', function($q) use($search){
$q->where('number','LIKE','%'.$search.'%');
});