Skip to content

Instantly share code, notes, and snippets.

View danclaytondev's full-sized avatar

Dan Clayton danclaytondev

View GitHub Profile
@danclaytondev
danclaytondev / nextstage.php
Last active May 7, 2021 13:54
Laravel Workflows using models
<?php
// This isn't quite the same as the production code, but I wanted to be clear in this demo!
class LoanApplication extends Model
{
public function getNextStage() ?WorkflowStage
{
$nextSequence = $this->workflow->sequences()
->where('sequence_number', $this->current_sequence_number + 1)