From 800e2347a6ecf997200f447c9fdbe3dce3a797f3 Mon Sep 17 00:00:00 2001 From: Ramon Dantas Date: Mon, 28 Oct 2024 08:32:31 -0300 Subject: [PATCH] feat: use `numeric` type on fields with `decimal` casts (#1583) * feat: use `numeric` type on fields with `decimal` casts * docs: update CHANGELOG.md --------- Co-authored-by: Barry vd. Heuvel --- CHANGELOG.md | 2 ++ src/Console/ModelsCommand.php | 2 ++ .../ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d323e1..2a0c812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file. ### Changed - Add support for multiple pivot types when using the same accessor. - Smarter reset, keep tags that IDE helper doesn't use +- Use `numeric` type on fields with `decimal` casts + 2024-10-18, 3.2.0 -------------- diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index ddf1dea..d930cdf 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -381,6 +381,8 @@ class ModelsCommand extends Command $realType = 'bool'; break; case 'decimal': + $realType = 'numeric'; + break; case 'string': case 'hashed': $realType = 'string'; diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index 11dc6cd..7db3339 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Model; * @property float $cast_to_real * @property float $cast_to_float * @property float $cast_to_double - * @property string $cast_to_decimal + * @property numeric $cast_to_decimal * @property string $cast_to_string * @property bool $cast_to_bool * @property bool $cast_to_boolean