Removing duplicates from My relations

Posted 4 months ago by Kareimovich

i have relation tags that nave many tasks every tag have some tasks i need to return un duplicated Tasks values

My Controller

    $Tasks= Path::with(['pathtags' => function ($q) use ($TagArray)
     {$q->with(['Tasks' => function ($q) use ($TagArray) {$q->has('tasktags', '=', 2)
    }])->where('id', '=', 1)->get();

My Blade

     @foreach ($posts2 as $item)
            <h2> {{$item->name}}</h2>

     @foreach ($item->pathtags as $Tag)
           <li> Path Tag :: {{ $Tag->name }} </li>

   @foreach ($Tag->Tasks as $Task)          
           <li> Task :: {{ $Task->task_name }} </li>

   @foreach ($Task->tasktags as $TaskTag)
          <li> Task Tags :: {{ $TaskTag->name }} </li>


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

Reply to

Use Markdown with GitHub-flavored code blocks.