From 9d7b5e9fcee05231ab7c61741b2b7c5fc666db7a Mon Sep 17 00:00:00 2001 From: Baspa Date: Thu, 12 Sep 2024 19:42:59 +0200 Subject: [PATCH] Add status attribute --- src/Models/Mail.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Models/Mail.php b/src/Models/Mail.php index 354fcda..50bdbff 100644 --- a/src/Models/Mail.php +++ b/src/Models/Mail.php @@ -161,4 +161,27 @@ public function scopeUnsent(Builder $query): Builder { return $query->whereNull('sent_at'); } -} + + public function getStatusAttribute(): string + { + if ($this->hard_bounced_at) { + return __('Hard Bounced'); + } elseif ($this->soft_bounced_at) { + return __('Soft Bounced'); + } elseif ($this->complained_at) { + return __('Complained'); + } elseif ($this->last_clicked_at) { + return __('Clicked'); + } elseif ($this->last_opened_at) { + return __('Opened'); + } elseif ($this->delivered_at) { + return __('Delivered'); + } elseif ($this->resent_at) { + return __('Resent'); + } elseif ($this->sent_at) { + return __('Sent'); + } else { + return __('Unsent'); + } + } +} \ No newline at end of file