user()?->unreadNotifications->markAsRead(); session()->flash('success', 'Все уведомления помечены как прочитанные.'); } public function markAsRead(string $id): void { $notification = auth()->user()?->notifications()->findOrFail($id); $notification->markAsRead(); } public function render() { $notifications = auth()->user() ?->notifications() ->latest() ->paginate(15); return view('livewire.notifications.notifications-page', [ 'notifications' => $notifications, ])->title('Уведомления'); } }