spatie/laravel-model-states
Add robust state behavior to Laravel Eloquent models using the state pattern and state machines. Represent each state as a class, cast states transparently to/from the database, and define clear, safe transitions with configurable state logic.
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.13.0...2.13.1
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.12.1...2.12.2
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.12.0...2.12.1
transitionableStateInstances() method to get state objects for all transitionable states by @A909M in https://github.com/spatie/laravel-model-states/pull/285Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.3...2.12.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.2...2.11.3
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.1...2.11.2
$baseStateClass and $defaultStateClass by @maartenpaauw in https://github.com/spatie/laravel-model-states/pull/275Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.11.0...2.11.1
HasStates trait. by @aSeriousDeveloper in https://github.com/spatie/laravel-model-states/pull/274Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.10.1...2.11.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.9.0...2.10.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.8.0...2.9.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.2...2.8.0
$allowedTransitions by @maartenpaauw in https://github.com/spatie/laravel-model-states/pull/259Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.1...2.7.2
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.0...2.7.1
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.2...2.7.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.1...2.6.2
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.0...2.6.1
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.5.0...2.6.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.6...2.5.0
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.5...2.4.6
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.4...2.4.5
RegisterState Attribute by @ralphjsmit in https://github.com/spatie/laravel-model-states/pull/224Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.3...2.4.4
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.2...2.4.3
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.1...2.4.2
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.0...2.4.1
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.3.0...2.4.0
getMorphClass (#198)transitionableStates methodcanTransition in State::canTransitionTo (#185)State::getModel() and State::getField()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.
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.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().laravel/framework:^8php:^7.4finalState in StateChanged eventTransitionNotFound attributes (#99)canTransitionTo (#92)0 state (#89)static:: call to self:: for private State::resolveStateMapping method (#75)whereState scope (#63)$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.newFull Changelog: https://github.com/spatie/laravel-model-states/compare/2.1.4...2.2.0
How can I help you explore Laravel packages today?