everybody, My code here is returning tasks that have more than 1 Tag and task tags are in $TagArray everything is working good in
return $TaskData;
but When I pass TaskData into view I get different results even get Tasks with one tag
return view ('task', compact('TaskData'));
My Code
$TaskData= Path::with(['pathtags' => function ($q) use ($TagArray) {
$q->with(['Tasks' => function($q) use ($TagArray) {
$q->has('tasktags', '=' , 2)->whereDoesntHave('tasktags',
function ($query) use ($TagArray) {
$query->whereNotIn('name', $TagArray);
}
)->with('tasktags');
}]);
}])->first();