public function getResidenceRoomTypes($confId, $residenceId) { if (!Entrust::can(PermissionNames::ConferenceRoomEdit($confId))) { return response("", 403); } $res = Residence::with("roomSets.type")->find($residenceId); if (is_null($res) || $res->conferenceID != $confId) { return response("", 404); } return RoomType::whereHas("roomSets", function ($query) use($res) { $query->where("residenceID", $res->id); })->get(); }