<?php

namespace App\Services\Notifications;

use App\Models\UserNotification;

class NotificationReadService
{
    public function markRead(int $userId, int $notificationId): bool
    {
        $row = UserNotification::query()
            ->where('user_id', $userId)
            ->where('notification_id', $notificationId)
            ->first();

        if (!$row) {
            return false;
        }

        $row->is_read = true;
        $row->save();

        return true;
    }
}
