From 643329d23d5bb376f1c96e17e5e3bae3ccf43cfa Mon Sep 17 00:00:00 2001 From: khaled sadek <65240054+khaled-sadek@users.noreply.github.com> Date: Wed, 7 Aug 2024 10:29:14 +0300 Subject: [PATCH] Fix type of hased model property (#1579) * set hashed properity as string * add to changelog * add test --- CHANGELOG.md | 1 + src/Console/ModelsCommand.php | 1 + tests/Console/ModelsCommand/SimpleCasts/Models/SimpleCast.php | 1 + .../ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php | 1 + 4 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 532de8a11..4a7a6709f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. -------------- ### Fixed +- Fix type of hashed model property to `string` ### Changed diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 8bdd55af1..f2a4253c4 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -382,6 +382,7 @@ public function castPropertiesType($model) break; case 'decimal': case 'string': + case 'hashed': $realType = 'string'; break; case 'array': diff --git a/tests/Console/ModelsCommand/SimpleCasts/Models/SimpleCast.php b/tests/Console/ModelsCommand/SimpleCasts/Models/SimpleCast.php index b9ce9ae70..ad818082f 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/Models/SimpleCast.php +++ b/tests/Console/ModelsCommand/SimpleCasts/Models/SimpleCast.php @@ -39,5 +39,6 @@ class SimpleCast extends Model 'cast_to_encrypted_collection' => 'encrypted:collection', 'cast_to_encrypted_json' => 'encrypted:json', 'cast_to_encrypted_object' => 'encrypted:object', + 'cast_to_hashed' => 'hashed', ]; } diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index 257a55d22..225813274 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -105,5 +105,6 @@ class SimpleCast extends Model 'cast_to_encrypted_collection' => 'encrypted:collection', 'cast_to_encrypted_json' => 'encrypted:json', 'cast_to_encrypted_object' => 'encrypted:object', + 'cast_to_hashed' => 'hashed', ]; }