File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 ));
You can’t perform that action at this time.
0 commit comments