mardi 23 octobre 2018

get tasks where all task tags is in path tags

My code returns tasks where one of Task Tags name ->(tasktags) is in Path Tags->$TagArray .

I want to get Tasks where all Task Tags (tasktags) are in Path Tags array ->$TagArray.

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

        })->with('tasktags');
    }]);
}])->first()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire