File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 22
33namespace Binarcode \LaravelMailator \Models ;
44
5+ use Binarcode \LaravelMailator \Models \Concerns \ConstraintsResolver ;
6+ use Binarcode \LaravelMailator \Models \Concerns \HasFuture ;
7+ use Binarcode \LaravelMailator \Models \Concerns \HasTarget ;
8+ use Binarcode \LaravelMailator \Support \ClassResolver ;
59use Carbon \Carbon ;
610use Illuminate \Database \Eloquent \Model ;
711
812/**
913 * Class MailatorLog
1014 * @property string $status
1115 * @property Carbon $created_at
16+ * @property array recipients
1217 * @package Binarcode\LaravelMailator\Models
1318 */
1419class MailatorLog extends Model
@@ -32,7 +37,7 @@ public function getTable()
3237 'updated_at ' ,
3338 ];
3439
35- protected $ cast = [
40+ protected $ casts = [
3641 'action_at ' => 'datetime ' ,
3742 'created_at ' => 'datetime ' ,
3843 'updated_at ' => 'datetime ' ,
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 ' => json_encode ( $ this ->getRecipients () ),
384+ 'recipients ' => $ 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 ' => json_encode ( $ this ->getRecipients () ),
401+ 'recipients ' => $ this ->getRecipients (),
402402 'name ' => $ this ->name ,
403403 'status ' => MailatorLog::STATUS_FAILED ,
404404 'action_at ' => now (),
@@ -418,7 +418,8 @@ public function markAsFailed(string $failureReason): self
418418 public function getRecipients (): array
419419 {
420420 return collect ($ this ->recipients )
421- ->filter (fn ($ email ) => $ this ->ensureValidEmail ($ email ));
421+ ->filter (fn ($ email ) => $ this ->ensureValidEmail ($ email ))
422+ ->toArray ();
422423 }
423424
424425 protected function ensureValidEmail (string $ email ): bool
You can’t perform that action at this time.
0 commit comments