• Mahmoud Aglan's avatar
    Mobile API Phase 2: Push notifications via Firebase Cloud Messaging · 0b2c6122
    Mahmoud Aglan authored
    - Install kreait/firebase-php SDK
    - Create PushNotificationService with 3-tier credential resolution
      (system_settings → storage file → env var, graceful degradation)
    - Auto-deactivate invalid/unregistered FCM tokens on send failure
    - Add Push case to NotificationChannel enum
    - Create 6 event listeners for push notifications:
      - AttendanceMarked → notify guardians (present/absent)
      - PaymentReceived → confirm payment to guardians
      - InvoiceCreated → alert guardians of new invoice
      - SessionCancelled → notify all group participants
      - EnrollmentCreated → confirm enrollment to guardians
      - EvaluationShared → notify guardians of new evaluation
    - Register all listeners in EventServiceProvider (queued)
    - Create NotificationController API endpoints:
      - GET notifications (paginated + unread count)
      - PATCH notifications/{id}/read
      - POST notifications/read-all
      - GET/POST notifications/preferences
    - Create scheduled push commands:
      - push:session-reminder (every minute, 30min before session)
      - push:installment-due (daily, 1 and 3 days before due)
    - Add channel_push column to notification_preferences
    - Total: 20 API endpoints now live
    Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    0b2c6122
NotificationChannel.php 563 Bytes