我需要获取路径标签并将其添加到变量中,以便可以将其替换为 ['XML','PHP','CSS3']。
$Paths = Path::with([
'ProgrammingField',
'pathtags' => function ($q) {
$q->with(['Tasks' => function ($q) {
$q->has('tasktags', '=', 2)
->orderBy('id', 'ASC')
->whereDoesntHave('tasktags',
function ($query) {
$query->whereNotIn('name', ['XML','PHP','CSS3']);
}
)
->with('tasktags')->orderBy('id', 'DESC');
}]);
}
])->whereIn('id', $pathId)->get();
尝试
$query->whereNotIn('name', $q->pathtags);