return view is returning different data

Posted 5 months ago by Kareimovich

Hi, everybody, My code here is returning tasks that have more than 1 Tag and task tags are in $TagArray everything is working good in

   return $TaskData;

but When I pass TaskData into view I get different results even get Tasks with one tag

        return view ('task',compact('TaskData'));

My Code

$TaskData= Path::with(['pathtags' => function ($q) use ($TagArray) {
$q->with(['Tasks'=>function($q) use ($TagArray) { 
    $q->has('tasktags', '=' , 2)->whereDoesntHave ('tasktags', function ($query) use     
     ($TagArray) {
            $query->whereNotIn('name',$TagArray);

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

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.