Skip to content

Commit 17811a6

Browse files
committed
Fix test
1 parent 680a569 commit 17811a6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/Models/Concerns/ConstraintsResolver.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,15 @@ public function constraintsDescriptions(): array
6060
return array_merge($base, $descriable::conditions());
6161
}, []);
6262
}
63+
64+
public function constraintsNotSatisfiedDescriptions(): array
65+
{
66+
return collect($this->constraints)
67+
->map(fn (string $event) => unserialize($event))
68+
->filter(fn ($event) => is_subclass_of($event, Descriptionable::class))
69+
->filter(fn ($event) => !$event->canSend($this, $this->logs))
70+
->reduce(function ($base, Descriptionable $descriable) {
71+
return array_merge($base, $descriable::conditions());
72+
}, []);
73+
}
6374
}

src/Models/MailatorSchedule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ public function markAsSent(): self
381381
{
382382
$this->logs()
383383
->create([
384-
'recipients' => $this->getRecipients()->toJson(),
384+
'recipients' => json_encode($this->getRecipients()),
385385
'name' => $this->name,
386386
'status' => MailatorLog::STATUS_SENT,
387387
'action_at' => now(),
@@ -398,7 +398,7 @@ public function markAsSent(): self
398398
public function markAsFailed(string $failureReason): self
399399
{
400400
$this->logs()->create([
401-
'recipients' => $this->getRecipients()->toJson(),
401+
'recipients' => json_encode($this->getRecipients()),
402402
'name' => $this->name,
403403
'status' => MailatorLog::STATUS_FAILED,
404404
'action_at' => now(),
@@ -415,7 +415,7 @@ public function markAsFailed(string $failureReason): self
415415
return $this;
416416
}
417417

418-
public function getRecipients(): \Collection
418+
public function getRecipients(): array
419419
{
420420
return collect($this->recipients)
421421
->filter(fn ($email) => $this->ensureValidEmail($email));

0 commit comments

Comments
 (0)