diff --git a/src/Models/Campaign.php b/src/Models/Campaign.php index 3ffac05d..0864b72a 100644 --- a/src/Models/Campaign.php +++ b/src/Models/Campaign.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\MorphMany; +use Illuminate\Database\Eloquent\Casts\Attribute; /** * @property int $id @@ -95,11 +96,11 @@ protected function casts(): array 'workspace_id' => 'int', 'template_id' => 'int', 'email_service_id' => 'int', - 'is_open_tracking' => 'bool', - 'is_click_tracking' => 'bool', + 'is_open_tracking' => 'boolean', + 'is_click_tracking' => 'boolean', 'scheduled_at' => 'datetime', - 'save_as_draft' => 'bool', - 'send_to_all' => 'bool', + 'save_as_draft' => 'boolean', + 'send_to_all' => 'boolean', ]; } @@ -388,4 +389,21 @@ public function allDraftsCreated(): bool return $this->active_subscriber_count === $this->messages()->count(); } + + /** + * Interact with `is_open_tracking` attribute. + */ + protected function getIsOpenTrackingAttribute($value) + { + return (bool)$value; + } + + + /** + * Interact with `is_click_tracking` attribute. + */ + protected function getIsClickTrackingAttribute($value) + { + return (bool)$value; + } }