Wherein in query function

Posted 5 months ago by Kareimovich

Hi, Everybody, I'm getting this error Undefined variable: TagArray When i write this Code

    $TagsArray = Path::with('pathtags')->first();

       foreach ($TagsArray->pathtags as $tags) {
       $TagArray[] = $tags->name;
    }

              $posts = Path::with(['pathtags' => function ($q)  {
             $q->with(['Tasks'=>function($q){
             $q->has('tasktags', '=' , 2)->whereIn('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.