Skip to content

Releases: webfox/laravel-backed-enums

v2.3.1

15 Mar 01:15
1c03550
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.3.0...v2.3.1

v2.3.0

12 Mar 09:08
a419e2f
Compare
Choose a tag to compare

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

07 Oct 06:50
06536dd
Compare
Choose a tag to compare

What's Changed

  • Add EnumCollection support by @hailwood in #17
    Fix toJson method to actually return a json string instead of an array.
    Add new AsFullEnumCollection 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

04 Oct 22:41
0f98556
Compare
Choose a tag to compare

Full Changelog: v2.1.0...v2.1.1

v2.1.0

04 Oct 22:33
0537422
Compare
Choose a tag to compare

What's Changed

  • Add static ::rule() method as a shortcut for the laravel enum validation @hailwood in 1309a36

Full Changelog: v2.0.0...v2.1.0

v2.0.0

28 Aug 03:03
6148068
Compare
Choose a tag to compare

Breaking change: the map method now uses the value rather then the name.

v1.2.3

01 Mar 21:03
Compare
Choose a tag to compare

What's Changed

  • Add additional comparison methods

Full Changelog: v1.1.0...v1.2.3

Add support for direct value comparisons

27 Feb 20:45
15321a2
Compare
Choose a tag to compare

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

22 Feb 04:15
Compare
Choose a tag to compare

What's Changed

  • Add support for laravel 10

v1.1.0

04 Oct 22:57
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.1.0