From 9d6bcc7ed1e5a04bb6ee0e0302ec1fc21f8d9c6a Mon Sep 17 00:00:00 2001 From: pataar Date: Fri, 11 Apr 2025 13:33:36 +0200 Subject: [PATCH] fix(ModelsCommand): use 'string' as realType for 'encrypted' casts --- src/Console/ModelsCommand.php | 4 +--- .../AdvancedCasts/__snapshots__/Test__test__1.php | 2 +- .../ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index aa389ec9a..b4421c430 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -410,9 +410,6 @@ public function castPropertiesType($model) $params = []; switch ($type) { - case 'encrypted': - $realType = 'mixed'; - break; case 'boolean': case 'bool': $realType = 'bool'; @@ -420,6 +417,7 @@ public function castPropertiesType($model) case 'decimal': $realType = 'numeric'; break; + case 'encrypted': case 'string': case 'hashed': $realType = 'string'; diff --git a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php index fbb6719f9..a60c2044b 100644 --- a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php @@ -21,7 +21,7 @@ * @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime * @property int $cast_to_timestamp - * @property mixed $cast_to_encrypted + * @property string $cast_to_encrypted * @property array $cast_to_encrypted_array * @property \Illuminate\Support\Collection $cast_to_encrypted_collection * @property array $cast_to_encrypted_json diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index 3041ecf07..b18dac9fa 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -33,7 +33,7 @@ * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime_serialization * @property int $cast_to_timestamp - * @property mixed $cast_to_encrypted + * @property string $cast_to_encrypted * @property array $cast_to_encrypted_array * @property \Illuminate\Support\Collection $cast_to_encrypted_collection * @property array $cast_to_encrypted_json