v2.0.0
Upgrade to v2 (please read UPGRADE.md file)
- add more elegant way to create an
EnumCollection
withtryFrom
andfrom
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