dimanche 21 octobre 2018

need to get Tasks where task tags is in $TagArray

Hi Everyone I need to get Task where all task tags name is in $TagArray I tried with My Code but it returns Tasks when any task tags are in $TagArray

My Code

$Tasks= 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();

this query check Task->Tags names in $TagArray but the problem is that it returning tasks when one of Task->Tags(tasktags) name is in $TagArray i need to return Task just When All Task->Tags (tasktags) names is in $tasktags

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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire