Files
alrahma_sunday_school_api/app/Services/Notifications/NotificationReadService.php
T
2026-06-08 23:45:55 -04:00

26 lines
488 B
PHP

<?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;
}
}