我想要的是,我还有一张桌子"评分"我存储tutor_is和一些导师的评级。我希望通过一些联接查询获得每位导师的所有评分及其平均评分
$tutors=TutorTimeSlot::
join('centers','centers.id', '=', 'tutor_time_slots.center_id')
->join('tutors', function ($join) use ($location_id) {
$join->on('tutors.id', '=', 'tutor_time_slots.tutor_id')
->where('tutors.location_id',$location_id);
})
->select('tutors.*','centers.id as center_id','centers.centername','centers.centerlocation','centers.lat','centers.lng')
->distinct()
->paginate(4);
return response()->json($tutors);