NotificationRecipient.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * @property int $id
  7. * @property int $notification_id
  8. * @property int|null $user_id
  9. * @property int|null $unit_id
  10. * @property int|null $franchisee_id
  11. * @property bool $is_read
  12. * @property \Illuminate\Support\Carbon|null $read_at
  13. * @property string $channel
  14. * @property bool $is_delivered
  15. * @property \Illuminate\Support\Carbon|null $delivered_at
  16. * @property string|null $delivery_error
  17. * @property \Illuminate\Support\Carbon|null $created_at
  18. * @property \Illuminate\Support\Carbon|null $updated_at
  19. * @property string|null $deleted_at
  20. * @property-read \App\Models\Notification $notification
  21. * @property-read \App\Models\User|null $user
  22. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient newModelQuery()
  23. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient newQuery()
  24. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient query()
  25. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereChannel($value)
  26. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereCreatedAt($value)
  27. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereDeletedAt($value)
  28. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereDeliveredAt($value)
  29. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereDeliveryError($value)
  30. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereFranchiseeId($value)
  31. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereId($value)
  32. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereIsDelivered($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereIsRead($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereNotificationId($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereReadAt($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereUnitId($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereUpdatedAt($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder<static>|NotificationRecipient whereUserId($value)
  39. * @mixin \Eloquent
  40. */
  41. class NotificationRecipient extends Model
  42. {
  43. use HasFactory;
  44. protected $table = 'notification_recipients';
  45. protected $guarded = [
  46. 'id', // Add more fields that shouldn't be edited here
  47. ];
  48. protected $casts = [
  49. 'is_read' => 'boolean',
  50. 'read_at' => 'datetime',
  51. 'is_delivered' => 'boolean',
  52. 'delivered_at' => 'datetime',
  53. 'created_at' => 'datetime',
  54. 'updated_at' => 'datetime',
  55. ];
  56. // Relationships
  57. public function notification(): \Illuminate\Database\Eloquent\Relations\BelongsTo
  58. {
  59. return $this->belongsTo(Notification::class, 'notification_id');
  60. }
  61. public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
  62. {
  63. return $this->belongsTo(User::class, 'user_id');
  64. }
  65. // Business Logic Methods
  66. // Custom Finders
  67. // Query Scopes
  68. }