Trying to get specific Data

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

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

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.