Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Model States Laravel Package

spatie/laravel-model-states

Add state-machine behaviour to Eloquent models: each state is its own class, with serialization handled automatically and state transitions made easy.

View on GitHub
Deep Wiki
Context7
2.14.2

What's Changed

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.14.1...2.14.2

2.14.1

What's Changed

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.14.0...2.14.1

2.14.0

What's Changed

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.13.1...2.14.0

2.13.0

What's Changed

  • Add Laravel 13 support
2.12.2

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.12.1...2.12.2

2.12.1

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.12.0...2.12.1

2.12.0

What's Changed

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.3...2.12.0

2.11.3

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.2...2.11.3

2.11.2

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.1...2.11.2

2.11.1

What's Changed

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.0...2.11.1

2.11.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.10.1...2.11.0

2.10.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.9.0...2.10.0

2.9.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.8.0...2.9.0

2.8.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.2...2.8.0

2.7.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.2...2.7.0

2.6.1

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.0...2.6.1

2.6.0
2.5.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.6...2.5.0

2.4.6

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.5...2.4.6

2.4.4
2.4.2

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.1...2.4.2

2.4.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.3.0...2.4.0

2.3.0
2.2.0
  • Better internal use of getMorphClass (#198)
2.1.2
  • Support for custom transition classes in transitionableStates method
2.1.1
  • Support for custom transition classes' canTransition in State::canTransitionTo (#185)
2.1.0
  • Add default transition config (#159)
2.0.2
  • Add State::getModel() and State::getField()
2.0.1
  • Fix bug on two consecutive transitions (#145)
2.0.0

The biggest change in v2 is that states now know which fields they belong to. So instead of having to pass in fields like so:

$model->canTransitionTo(StateB::class, 'status');
































You can now do:

$model->status->canTransitionTo(StateB::class);
































This change means that a lot of boilerplate code can be removed. Also keep in mind that this package wants you to always use state objects, and never their serialized values. That's why many other methods have been removed, in favour of Laravel's built-in model casts.

  • States aren't configured on models anymore, but on the state class itself. Refer to the docs for more info.
  • HasStates::transitionableStates(string $fromClass, string $field) has been removed.
  • State::transitionableStates() now doesn't need the $field parameter anymore.
  • HasStates::getStates() now returns the morph values instead of the hardcoded class names.
  • Default states are only set on model creations.
  • State::find() has been removed.
  • State::isOneOf() is removed, State::equals now accepts multiple state objects or morph classes.
  • State::is() is removed, you should use State::equals().
  • Dropped support for Laravel 5, 6, and 7. The minimal required version is laravel/framework:^8
  • Dropped support for PHP 7.2 and 7.3. The minimal required version is php:^7.4
  • Proper support for finalState in StateChanged event
1.9.1
  • add support for PHP 8.0 (#141)
1.9.0
  • add support for Laravel 8 (#101)
1.8.0
  • Add getters for TransitionNotFound attributes (#99)
1.7.0
  • Add canTransitionTo (#92)
1.6.3
  • Support 0 state (#89)
1.6.2
  • Support model::updated state casting (#88, 351c008)
1.6.1
  • change static:: call to self:: for private State::resolveStateMapping method (#75)
1.6.0
  • add support for Laravel 7
1.5.1
  • Add support for fully qualified column names in whereState scope (#63)
1.5.0
  • ❗️ $finalState in the StateChanged event is deprecated and will always be null. This is because of a fix for bug #49. This fix might have unforeseen effects if you're using StateChanged.
1.4.2
  • Fix for unknown $modelClass variable (#47)
1.4.1
  • Return Eloquent model when using transitionTo method directly (#33)
1.4.0
  • Add better exceptions and Ignition support (#23)
1.3.1
1.3.0
  • Allow to get transitional states (#17)
1.2.0
  • Add state listing methods (#21)
1.1.3
  • Proper support for non-string columns
1.1.2
  • Proper support for JSON serialise
1.1.1
  • Default support via new
1.1.0
  • Improved default support
1.0.1
  • Properly handle corrupt state values from the database
1.0.0
  • initial release
What's
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
alphabalex/messaging-made-easy
rawphp/warp
shootkiran/merobug
narakode/fineauth
numencode/wn-syncops-plugin
ibnnajjaar/mib-global-pay
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator