Skip to content

Commit

Permalink
Accessor set for is_open_tracking and is_click_tracking
Browse files Browse the repository at this point in the history
- The issue is in sendportal_campaigns table we have 2 columns is_open_tracking and is_click_tracking , it have value stored as 0, 1 but the expected value by function is true/false
- mettle/sendportal#313
  • Loading branch information
afrasiyabhaider committed Sep 16, 2024
1 parent 6e6ce11 commit 109cbb9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Models/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -388,4 +389,25 @@ public function allDraftsCreated(): bool

return $this->active_subscriber_count === $this->messages()->count();
}

/**
* Interact with `is_open_tracking` attribute.
*/
protected function isOpenTracking(): Attribute
{
return Attribute::make(
get: fn(mixed $value) => (bool)$value,
);
}


/**
* Interact with `is_click_tracking` attribute.
*/
protected function isClickTracking($value)
{
return Attribute::make(
get: fn(mixed $value) => (bool)$value,
);
}
}

0 comments on commit 109cbb9

Please sign in to comment.