Can not get data with right tags

Posted 9 months ago by Kareimovich

need to get Tasks where all tasktags-> name is in $TagArray array but instead, I get tasks where one of tasktags-> name is in $TagArray I'm using

                    $query->whereIn('name', $TagArray );

but not working as wanted

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

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