Releases: webfox/laravel-backed-enums
Releases · webfox/laravel-backed-enums
v2.3.1
What's Changed
- Add unit/feature tests by @hailwood in #25
- Fix
::labels()
method by @hailwood in #25 - Add
AsFullEnumCollection::of(MyEnum::class)
for casts by @hailwood in #25 - Fix Issue #22: Replace 'self' with 'static' by @vikas020807 in #24
New Contributors
- @vikas020807 made their first contribution in #24
Full Changelog: v2.3.0...v2.3.1
v2.3.0
What's Changed
- Bumping to version 11 of the Laravel framework (ahead of launch tomorrow) by @csoutham in #23
- Bump stefanzweifel/git-auto-commit-action from 4 to 5 by @dependabot in #19
New Contributors
Full Changelog: v2.2.0...v2.3.0
v2.2.0
What's Changed
- Add EnumCollection support by @hailwood in #17
Fix toJson method to actually return a json string instead of an array.
Add newAsFullEnumCollection
cast - See the readme for usage and a description of why this is useful.
Full Changelog: v2.1.1...v2.2.0
v2.1.1
Full Changelog: v2.1.0...v2.1.1
v2.1.0
v2.0.0
Breaking change: the map
method now uses the value rather then the name.
v1.2.3
Add support for direct value comparisons
Right now if you want to use ->isA
or ->isAny
or the other comparison methods you must pass in an enum instance, I.e.
$user->role->isA(MyEnum::from('admin')); // true
$user->role->isA('admin'); // false
$user->role->isA(MyEnum::from('not-a-value')); // exception
$user->role->isA('not-a-value'); // false
$user->role->isAny([MyEnum::from('admin')]); // true
$user->role->isAny(['admin']); // false
$user->role->isAny([MyEnum::from('not-a-value')]); // exception
$user->role->isAny(['not-a-value']); // false
This release makes it so each pair of methods will act the same whether given a string value or an enum instance.
$user->role->isA(MyEnum::from('admin')); // true
$user->role->isA('admin'); // true
$user->role->isA(MyEnum::from('not-a-value')); // exception
$user->role->isA('not-a-value'); // exception
$user->role->isAny([MyEnum::from('admin')]); // true
$user->role->isAny(['admin']); // true
$user->role->isAny([MyEnum::from('not-a-value')]); // exception
$user->role->isAny(['not-a-value']); // exception
This also applies for isAn, isNotA, isNotAn, isNotAny
v1.2.1
What's Changed
- Add support for laravel 10