Skip to content

v2.0.0

Compare
Choose a tag to compare
@trippo trippo released this 14 Mar 15:00
· 80 commits to main since this release
fbfc944

Upgrade to v2 (please read UPGRADE.md file)

  • add more elegant way to create an EnumCollection with tryFrom and from method
EnumCollection::of(Enum::class)->from($data);
EnumCollection::of(Enum::class)->tryFrom($data);
EnumCollection::from($data, Enum::class);
EnumCollection::tryFrom($data, Enum::class);
  • change casting definition in only onle line inside casts model property
//Laravel 9/10
protected $casts = [
    'field_name' => AsLaravelEnumCollection::class.':'.FieldEnum::class,
];

//Laravel 11
protected function casts(): array
{
    return [
        'field_name' => AsLaravelEnumCollection::of(FieldEnum::class),
    ];
}
  • add Laravel 11 support
  • refactoring