All notable changes to laravel-model-states
will be documented in this file (#188)
- [docs] Fix documentation badges by @maartenpaauw in #254
- [docs] Add generic docblock to code snippet by @maartenpaauw in #253
- Fix missing namespace in phpdoc by @conorjmurphy in #255
- Update 01-introduction.md by @StreetYo in #257
- docs: update 03-listing-states.md improve use statements by @mmachatschek in #261
- fix(config): var annotation for
$allowedTransitions
by @maartenpaauw in #259
- @maartenpaauw made their first contribution in #254
- @conorjmurphy made their first contribution in #255
- @StreetYo made their first contribution in #257
- @mmachatschek made their first contribution in #261
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.1...2.7.2
- Use jsonSerialize in StateCaster by @piotrjoniec in #252
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.7.0...2.7.1
- Implement SerializesCastableAttributes in StateCaster by @piotrjoniec in #251
- @piotrjoniec made their first contribution in #251
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.2...2.7.0
- Add support for laravel 11 by @shuvroroy in #249
- @shuvroroy made their first contribution in #249
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.1...2.6.2
- Typo in 01-configuring-states.md by @MarceauKa in #241
- Bump stefanzweifel/git-auto-commit-action from 4 to 5 by @dependabot in #240
- Bump actions/cache from 3 to 4 by @dependabot in #245
- Generics PHPDoc annotations for State class by @lorenzolosa in #247
- @MarceauKa made their first contribution in #241
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.6.0...2.6.1
- Feature/Method to allow all state transitions by @fmeccanici in #238
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.5.0...2.6.0
- Bump actions/checkout from 3 to 4 by @dependabot in #236
- Feature/Allow to set custom StateChanged event by @fmeccanici in #237
- @fmeccanici made their first contribution in #237
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.6...2.5.0
- Don't assume scandir() always returns current and parent directory first by @sebastiandedeyne in #228
- @sebastiandedeyne made their first contribution in #228
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.5...2.4.6
- Refactor tests to pest by @AyoobMH in #217
- @AyoobMH made their first contribution in #217
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.4...2.4.5
- Add missing
RegisterState
Attribute by @ralphjsmit in #224
- @ralphjsmit made their first contribution in #224
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.3...2.4.4
- Recommend not to use hypens in the name by @barclaymichael in #210
- Add Dependabot Automation by @patinthehat in #218
- Bump actions/checkout from 2 to 3 by @dependabot in #219
- Bump actions/cache from 2 to 3 by @dependabot in #220
- Add PHP 8.2 Support by @patinthehat in #221
- Update deps for laravel 10 by @hailam in #223
- @barclaymichael made their first contribution in #210
- @dependabot made their first contribution in #219
- @hailam made their first contribution in #223
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.2...2.4.3
- Removed Model type enforcement and replaced with PHPDoc by @luckcolors in #208
- @luckcolors made their first contribution in #208
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.1...2.4.2
- Update .gitattributes by @angeljqv in #205
- Ensures field is always set when changing states by @ChangingTerry in #207
- @angeljqv made their first contribution in #205
- @ChangingTerry made their first contribution in #207
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.4.0...2.4.1
- Manually register concrete state classes by @javoscript in #203
- @javoscript made their first contribution in #203
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.3.0...2.4.0
- Update 03-listing-stated.md // Wrong namespace in the docs by @SahinU88 in #200
- Add orWhereState and orWhereNotState by @masterix21 in #201
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.2.0...2.3.0
- Use getMorphClass method when resolving state class. by @kayrunm in #198
- @kayrunm made their first contribution in #198
Full Changelog: https://github.com/spatie/laravel-model-states/compare/2.1.4...2.2.0
- Better internal use of
getMorphClass
(#198)
- Support for custom transition classes in
transitionableStates
method
- Support for custom transition classes'
canTransition
inState::canTransitionTo
(#185)
- Add default transition config (#159)
- Add
State::getModel()
andState::getField()
- Fix bug on two consecutive transitions (#145)
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 useState::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
inStateChanged
event
- add support for PHP 8.0 (#141)
- add support for Laravel 8 (#101)
- Add getters for
TransitionNotFound
attributes (#99)
- Add
canTransitionTo
(#92)
- Support
0
state (#89)
- change
static::
call toself::
for privateState::resolveStateMapping
method (#75)
- add support for Laravel 7
- Add support for fully qualified column names in
whereState
scope (#63)
- ❗️
$finalState
in theStateChanged
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 usingStateChanged
.
- Fix for unknown $modelClass variable (#47)
- Return Eloquent model when using transitionTo method directly (#33)
- Add better exceptions and Ignition support (#23)
- Revert 06a4359
- Allow to get transitional states (#17)
- Add state listing methods (#21)
- Proper support for non-string columns
- Proper support for JSON serialise
- Default support via
new
- Improved default support
- Properly handle corrupt state values from the database
- initial release