Skip to content

Commit

Permalink
Form submission returning null (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
anditopping authored Sep 16, 2024
1 parent d94a333 commit b925b0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Listeners/AddFromSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class AddFromSubmission
{
public function handle(SubmissionCreated $event)
{
Subscriber::fromSubmission($event->submission)->subscribe();
Subscriber::fromSubmission($event->submission)?->subscribe();
}
}
2 changes: 2 additions & 0 deletions src/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public static function fromSubmission(Submission $submission): ?self
return null;
}

$config['form'] = $form->handle();

return new self($submission->data(), $config);
}

Expand Down
1 change: 1 addition & 0 deletions tests/Unit/SubscriberFromSubmissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public function it_gets_config_from_form()
$settings = [
'check_consent' => true,
'primary_email_field' => 'email',
'form' => 'contact_us',
];

$this->form->merge([
Expand Down

0 comments on commit b925b0e

Please sign in to comment.