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

fix: float not assignable to decimal cast #1872

Merged
merged 2 commits into from
Apr 14, 2024
Merged

Conversation

calebdw
Copy link
Contributor

@calebdw calebdw commented Mar 8, 2024

  • Added or updated tests
  • Documented user facing changes

Closes #1869

Changes
Hello!

This PR updates the Eloquent decimal writable type to accept float.

I also tried to cleanup the file a bit by using the ::class constant instead of the entire raw class string, but feel free to pop that off if you don't like it.

Thanks!

'decimal' => TypeCombinator::intersect(new StringType(), new AccessoryNumericStringType()),
'decimal' => TypeCombinator::intersect(new StringType(), new AccessoryNumericStringType(), new FloatType()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real change.

@canvural
Copy link
Collaborator

Adding just the float is right here. Thanks!

@canvural canvural merged commit 899af49 into larastan:2.x Apr 14, 2024
33 checks passed
@calebdw calebdw deleted the decimal_cast branch April 14, 2024 12:43
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.

Model property with decimal cast (numeric-string) does not accept float or int
3 participants