add notifications logic and add support of both JWT and Sanctum

This commit is contained in:
root
2026-03-11 01:20:31 -04:00
parent f6be51576c
commit 182036cc41
141 changed files with 8685 additions and 648 deletions
@@ -0,0 +1,28 @@
<?php
namespace App\Services\Notifications;
use App\Models\UserNotification;
class NotificationShowService
{
public function getForUser(int $userId, int $notificationId): ?array
{
$row = UserNotification::query()
->select([
'user_notifications.*',
'notifications.title',
'notifications.message',
'notifications.priority',
'notifications.scheduled_at',
'notifications.expires_at',
'notifications.target_group',
])
->join('notifications', 'notifications.id', '=', 'user_notifications.notification_id')
->where('user_notifications.user_id', $userId)
->where('user_notifications.notification_id', $notificationId)
->first();
return $row ? $row->toArray() : null;
}
}