Skip to content

Instantly share code, notes, and snippets.

@rmcdaniel
Created October 29, 2022 03:36
Show Gist options
  • Save rmcdaniel/9045dc570047ab663e217efada92a6d4 to your computer and use it in GitHub Desktop.
Save rmcdaniel/9045dc570047ab663e217efada92a6d4 to your computer and use it in GitHub Desktop.
<?php
use App\Workflows\VerifyEmail\VerifyEmailWorkflow;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Route;
use Workflow\WorkflowStub;
Route::get('/register', function () {
$workflow = WorkflowStub::make(VerifyEmailWorkflow::class);
$workflow->start(
'[email protected]',
Hash::make('password'),
);
return response()->json([
'workflow_id' => $workflow->id(),
]);
});
Route::get('/verify-email', function () {
$workflow = WorkflowStub::load(request('workflow_id'));
$workflow->verify();
return response()->json('ok');
})->name('verify-email');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment