Trying to get specific Data

Posted 9 months ago by Kareimovich

I'm trying to get Tasks where All tasktags name is in $TagArray

$posts2 = Path::with(['pathtags' => function ($q) use ($TagArray) {
    $q->with(['Tasks'=>function($q) use ($TagArray) { 
        $q->has('tasktags', '>' , 1)->whereHas('tasktags', function ($query) use ($TagArray) {
                $query->whereIn('name',$TagArray);
         
        })->with('tasktags');
    }]);
}])->first();

but instead, I get tasks where 1 of tasktags Name is in array I want to get task if only all tasktags name in $TagArray

Please sign in or create an account to participate in this conversation.