Laravel pluck an array from nested relationship

Posted 2 weeks ago by DivPro

I need to get pathtags and add it to a variable so I can replace it with ['XML','PHP','CSS3'].

   $Paths= Path::with(['ProgrammingField','pathtags' => function ($q) 
   {$q->with(['Tasks' => function ($q) 
   {$q->has('tasktags', '=', 2)->orderBy('id', 'ASC')
     function ($query)  {
   $query->whereNotIn('name', ['XML','PHP','CSS3']);
            ->with('tasktags')->orderBy('id', 'DESC');
          ->whereIn('id', $pathId)->get();


      $query->whereNotIn('name', $q->pathtags);

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.