Created
October 29, 2022 03:52
-
-
Save rmcdaniel/2164f56a6ad586b5d78676119b511ff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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