protected function validatePreviousState($allowedStates = [], $toState)
{
$state = $this->getAttribute('state');
if (!in_array($state, $allowedStates)) {
$fromState = !$state ? 'NULL' : $state;
$message = "Transaction state: {$fromState} cannot be changed to a: {$toState} state.";
throw new InvalidTransactionStateException($message);
}
return true;
}