Skip to content

Commit

Permalink
Merge pull request #2 from Briareos17/feature/ignore-transition-to-sa…
Browse files Browse the repository at this point in the history
…me-state

Add ability to ignore transition to same state
  • Loading branch information
Briareos17 authored Oct 24, 2024
2 parents 2701b18 + eb40756 commit c8dbe46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/StateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public function isTransitionAllowed(string $fromMorphClass, string $toMorphClass

public function resolveTransitionClass(string $fromMorphClass, string $toMorphClass): ?string
{
if($this->shouldIgnoreSameState && $fromMorphClass === $toMorphClass) {
return null;
}

$transitionKey = $this->createTransitionKey($fromMorphClass, $toMorphClass);

return $this->allowedTransitions[$transitionKey];
if(array_key_exists($transitionKey, $this->allowedTransitions)) {
return $this->allowedTransitions[$transitionKey];
}

return null;
}

public function transitionableStates(string $fromMorphClass): array
Expand Down

0 comments on commit c8dbe46

Please sign in to comment.