Slide 141
Slide 141 text
Model State Machine The Implementation
public function state(): InvoiceStateContract
{
}
return match ($this->status) {
'draft' => new DraftInvoiceState($this),
'open' => new OpenInvoiceState($this),
'paid' => new PaidInvoiceState($this),
'void' => new VoidInvoiceState($this),
'uncollectable' => new UncollectableInvoiceState($this),
default => throw new InvalidArgumentException('Invalid status'),
};