@php use Illuminate\Support\Facades\Schema; $hasTable = Schema::hasTable('notifications'); $unread = (auth()->check() && $hasTable) ? auth()->user()->unreadNotifications()->count() : 0; $latest = (auth()->check() && $hasTable) ? auth()->user()->notifications()->latest()->limit(5)->get() : collect(); @endphp