@php $unreadMessagesCount = 0; if ($page && auth()->check()) { $unreadMessagesCount = \App\Models\Portal\Chat::where('page_id', $page->id) ->where('to_user_id', auth()->id()) ->where('read', false) ->count(); } @endphp