@php $auth = Auth::user(); if ($auth && is_object($auth)) { $userMaterial = $auth->userMaterials->where('material_id', $material->id)->first(); } @endphp @if ($userMaterial and $userMaterial->completed) @php $next = $material->sub_module->materials->where('id', '>', $material->id)->first(); $ass = $material->sub_module->assignments->whereNotIn('id',$auth->userAssignments->pluck('assignment_id'))->first(); @endphp

Completed

@if ($next) Go to next item @elseif ($ass) Go to next item @endif @else
@csrf @if ($material and $material->reading) @endif
@endif