I need to get next value in array after $level_task->task_name==$task->task_name so I can make link for next task

@foreach ($tasks as $level_task)

    @if ($level_task->task_name==$task->task_name)
        <a href="{{route('task', ['category' =>$level_task->path->category->slug,'level'=>$level_task->task_level,'path'=>$level_task->path->slug,'slug' => $level_task->slug])}}" class="list-group-item list-group-item-action {{$level_task->task_name==$task->task_name ? "active":""}}">{{$level_task->task_name}}</a>
    @elseif  ($level_task->task_name!=$task->task_name)
        <a href="{{route('task', ['category' =>$level_task->path->category->slug,'level'=>$level_task->task_level,'path'=>$level_task->path->slug,'slug' => $level_task->slug])}}" class="list-group-item list-group-item-action {{$level_task->task_name==$task->task_name ? "active":""}}">{{$level_task->task_name}}</a>
    @endif

@endforeach

0 Answers