Skip to content

Instantly share code, notes, and snippets.

@rmcdaniel
Created October 29, 2022 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmcdaniel/2164f56a6ad586b5d78676119b511ff4 to your computer and use it in GitHub Desktop.
Save rmcdaniel/2164f56a6ad586b5d78676119b511ff4 to your computer and use it in GitHub Desktop.
<?php
namespace App\Workflows\VerifyEmail;
use Workflow\ActivityStub;
use Workflow\SignalMethod;
use Workflow\Workflow;
use Workflow\WorkflowStub;
class VerifyEmailWorkflow extends Workflow
{
private bool $verified = false;
#[SignalMethod]
public function verify()
{
$this->verified = true;
}
public function execute($email = '', $password = '')
{
yield ActivityStub::make(SendEmailVerificationEmailActivity::class, $email);
yield WorkflowStub::await(fn () => $this->verified);
yield ActivityStub::make(VerifyEmailActivity::class, $email, $password);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment