@@ 144-157 (lines=14) @@ | ||
141 | * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact |
|
142 | * @param \TestMonitor\ActiveCampaign\Resources\Automation $automation |
|
143 | */ |
|
144 | public function removeAutomationFromContact(Contact $contact, Automation $automation) |
|
145 | { |
|
146 | $contactAutomations = $this->contactAutomations($contact); |
|
147 | ||
148 | $contactAutomation = current(array_filter($contactAutomations, function ($contactAutomation) use ($automation) { |
|
149 | return $contactAutomation->automation == $automation->id; |
|
150 | })); |
|
151 | ||
152 | if (empty($contactAutomation)) { |
|
153 | return; |
|
154 | } |
|
155 | ||
156 | $this->delete("contactAutomations/{$contactAutomation->id}"); |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * Removing all automations from a contact. |
|
@@ 179-192 (lines=14) @@ | ||
176 | * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact |
|
177 | * @param \TestMonitor\ActiveCampaign\Resources\Tag $tag |
|
178 | */ |
|
179 | public function removeTagFromContact(Contact $contact, Tag $tag) |
|
180 | { |
|
181 | $contactTags = $this->contactTags($contact); |
|
182 | ||
183 | $contactTag = current(array_filter($contactTags, function ($contactTag) use ($tag) { |
|
184 | return $contactTag->tag == $tag->id; |
|
185 | })); |
|
186 | ||
187 | if (empty($contactTag)) { |
|
188 | return; |
|
189 | } |
|
190 | ||
191 | $this->delete("contactTags/{$contactTag->id}"); |
|
192 | } |
|
193 | } |
|
194 |