I need to sort my tasks by id and it is working fine when all tasks are from 1 tag but when there is more than one tag I get a result like the one under My Controller
My Controller :
$Task = Enrollee::
->with(['path.pathtags' => function ($q) use ($TagArray)
{
$q->with(['Tasks' => function ($q) use ($TagArray)
{
$q->has('tasktags', '=', 2)
->orderBy('id', 'asc')
->whereDoesntHave(
'tasktags',
function ($query) use ($TagArray) {
$query->whereNotIn('name', $TagArray);
}
)
->with('tasktags')->orderBy('id', 'asc');
}]
)->orderBy('id', 'desc');
}])
So My Output is like
Tag : Art
Post id : 8
Post Name : Post About art..
.................
Tag : fun
Post id : 9
Post Name : Post About fun..
...................
Tag : Food
Post id : 11
Post Name : Post About food..
So i need to get them correctly by id
11
9
8