everybody, My code here is returning tasks that have more than 1 Tag and and the code is working fine until I pass it to view it return all tasks even tasks that has one tag My Code
$posts = Path::with(['pathtags' => function ($q) {
$q->with(['Tasks'=>function($q){
$q->has('tasktags', '=' , 2)->with('tasktags');
}]);
}])
->where('id','>',1)->get();
My View
return view ('task',compact('posts'));
@foreach ($posts as $Task)
<h2></h2>
@foreach ($Task->pathtags as $Tag)
<h3></h3>
@foreach ($Tag->tasks as $Ta)
<h2></h2>
@endforeach
@endforeach
@endforeach
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire