NotificationDeliveryLog.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. class NotificationDeliveryLog extends Model
  7. {
  8. use HasFactory;
  9. public const CHANNEL_IN_APP = 'in_app';
  10. public const CHANNEL_BROWSER = 'browser';
  11. public const CHANNEL_PUSH = 'push';
  12. public const CHANNEL_EMAIL = 'email';
  13. public const STATUS_SENT = 'sent';
  14. public const STATUS_FAILED = 'failed';
  15. public const STATUS_SKIPPED = 'skipped';
  16. public const STATUS_DEAD_LETTER = 'dead_letter';
  17. public const DEFAULT_SORT_BY = 'created_at';
  18. public const DEFAULT_ORDER_BY = 'desc';
  19. protected $fillable = [
  20. 'user_notification_id',
  21. 'user_id',
  22. 'channel',
  23. 'status',
  24. 'attempt',
  25. 'message',
  26. 'error',
  27. ];
  28. public function user(): BelongsTo
  29. {
  30. return $this->belongsTo(User::class);
  31. }
  32. public function userNotification(): BelongsTo
  33. {
  34. return $this->belongsTo(UserNotification::class);
  35. }
  36. }