$transaction = new Transaction();
$transaction->reference = 1;
$transaction->save();
// state is 'draft', as expected
$transaction->state->transitionTo(ProcessingState::class);
$transaction->save();
// state is still 'draft', but it should be 'processing'
pszucs/spatie-laravel-model-states-transitions-using-mutators
Repo to test transitions when using model mutators
PHP