44
55use Carbon \Carbon ;
66use Illuminate \Database \Eloquent \Factories \Factory ;
7+ use Wazza \DbEncrypt \Helper \Encryptor ;
78
89class EncryptedAttributesFactory extends Factory
910{
@@ -14,17 +15,17 @@ class EncryptedAttributesFactory extends Factory
1415 */
1516 public function definition (): array
1617 {
18+ $ randomText = $ this ->faker ->text (50 );
19+ $ encryptedText = Encryptor::encrypt ($ randomText );
20+ $ hashIndex = Encryptor::hash ($ randomText );
1721 return [
18- 'entity_id ' => null ,
19- 'state_id ' => null ,
20- 'type ' => $ this ->faker ->randomElement (['physical ' , 'billing ' , 'postal ' ]),
21- 'building_name ' => $ this ->faker ->word (),
22- 'floor_number ' => $ this ->faker ->word (),
23- 'address1 ' => $ this ->faker ->streetAddress (),
24- 'address2 ' => $ this ->faker ->secondaryAddress (),
25- 'city ' => $ this ->faker ->city (),
26- 'postcode ' => $ this ->faker ->postcode (),
27- 'comments ' => $ this ->faker ->text (2000 ),
22+ 'object_type ' => 'users ' ,
23+ 'object_id ' => $ this ->faker ->randomNumber (5 ),
24+ 'attribute ' => $ this ->faker ->randomElement (['social_security_number ' , 'private_note ' , 'custom_field ' ]),
25+ 'hash_index ' => $ hashIndex ,
26+ 'encrypted_value ' => $ encryptedText ,
27+ 'created_at ' => now (),
28+ 'updated_at ' => now (),
2829 ];
2930 }
3031}
0 commit comments