Can not get data with right tags

Posted 3 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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.