@php $total = $job->comments->count(); $count = 0; foreach ($job->comments as $comment){ $count += $comment->readers->where('id', Auth::user()->id)->count(); } $unread = $total-$count; @endphp @if($unread) {{ $unread }} @endif