Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Add ability to set a custom class for the AsCollection and AsEncryptedCollection casts #46619

Merged
merged 11 commits into from
Apr 3, 2023
Merged

[10.x] Add ability to set a custom class for the AsCollection and AsEncryptedCollection casts #46619

merged 11 commits into from
Apr 3, 2023

Conversation

osbre
Copy link
Contributor

@osbre osbre commented Mar 28, 2023

Example:

protected $casts = [
    'elements' => AsCollection::class.':'.ElementCollection::class,
    // or
    'elements' => AsEncryptedCollection::class.':'.ElementCollection::class,
];

(In a similar way to AsEnumCollection)

protected $casts = [
    'statuses' => AsEnumCollection::class.':'.ServerStatus::class,
];

@osbre osbre changed the title [10.x] Add ability to set a custom collection class for the AsCollection cast [10.x] Add ability to set a custom collection class for the AsCollection and AsEncryptedCollection casts Mar 28, 2023
@osbre osbre changed the title [10.x] Add ability to set a custom collection class for the AsCollection and AsEncryptedCollection casts [10.x] Add ability to set a custom class for the AsCollection and AsEncryptedCollection casts Mar 28, 2023
@taylorotwell taylorotwell merged commit 5c9656e into laravel:10.x Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants