mardi 27 novembre 2018

Laravel pluck an array from nested relationship 2

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')
   ->whereDoesntHave('tasktags',
   function ($query)  {
       $query->whereNotIn('name', ['XML','PHP','CSS3']);
   }
    )
       ->with('tasktags')->orderBy('id', 'DESC');
   }]);
   }])
    ->whereIn('id', $pathId)->get();

Tried

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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire