Code Monkey home page Code Monkey logo

Comments (6)

ionghitun avatar ionghitun commented on May 28, 2024

Hi @UsamaKhan-hub can you show me what's in encrypted attribute for ContactGroup and Contact model?

from laravel-lumen-mysql-encryption.

UsamaKhan-hub avatar UsamaKhan-hub commented on May 28, 2024

Hi @UsamaKhan-hub can you show me what's in encrypted attribute for ContactGroup and Contact model?

ContactGroup model just have foreign keys so i didnt use encryptable array, and in contact model i have placed many attributes in encryptable array
When fetching only contacts data like : Contact::latest()->first() and then return response i didnt find any difficulty to return data but using relation , i am facing malformed utf8 issue.

You can see the below relation response on contacts data
#relations: array:1 [
"contacts" => Illuminate\Database\Eloquent\Collection {#1839
#items: array:2 [
0 => App\Models\Tenants\Contacts\Contact {#1860
#connection: "tenant"
#table: "contacts"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
+preventsLazyLoading: false
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#escapeWhenCastingToString: false
#attributes: array:23 [
"id" => 1
"contact_board_id" => 1
"contact_group_id" => 1
"title" => b"±$á{+\x1DºûE]½š%F\x06Å"
"first_name" => b"@▄èÕ▓xM³└\x0Eha)┼ìı\e,\fWÏÇ\x11\x15\x05K~aÇòz"
"surname" => b"!õ‡±q9\x08z\x1A%fyPl\x19¦"
"email" => b"\x16j▒òÃ┬┌ý×\x05zÉv┤Õ¸\x12_%┘Ë\x1FG´¤×╠R-÷ÚZ"
"address_1" => b"aÉUÉÀ¬║IÔ\x03Ó?¹äÓ"®■7╔\x04RÞ╠±\x14\x19¶├¬ï┼d/é■\x04è¿─DÓ½æ¿i╚\x06n│▓ëS¼HGı£§T└
ÿ\v"
"address_2" => b"r\x14é½—ÈHdBNU³Ñ\x03“ªÃlKlß}Ef*N½‹Ô]Ÿ\x1F[kZpiÎVî3Zɇ&8M0\x02èo;ËÙξò»LÊÓ™ÞH"
"postcode" => b"VYªól;\x13\x19Ѷ&\x13çm\2"
"town_city" => b"fºû+£v\x13ÐHühR'Y\x1DÅ"
"state" => b"œkoäÉë“\x1AäuÛE¡¢[¸"

from laravel-lumen-mysql-encryption.

ionghitun avatar ionghitun commented on May 28, 2024

Ok, thanks, will look into that asap!

from laravel-lumen-mysql-encryption.

UsamaKhan-hub avatar UsamaKhan-hub commented on May 28, 2024

Ok, thanks, will look into that asap!

Sure, thanks for responding.

from laravel-lumen-mysql-encryption.

ionghitun avatar ionghitun commented on May 28, 2024

Tried to test is this way:

$parent = Parent::with(['child' =>function($query) {
	$query->select(['id','parentid', 'encrypted_field']);
} ])->find(1);

dd($parent->toJson());
dd($parent->toArray());

And it worked perfect for me, can you try grabbing only one, maybe check your data, you can use a query like this directly in db:
SELECT AES_DECRYPT(encrypted_column, 'ENCRYPTION_KEY') FROM table WHERE ...

from laravel-lumen-mysql-encryption.

UsamaKhan-hub avatar UsamaKhan-hub commented on May 28, 2024

Tried to test is this way:

$parent = Parent::with(['child' =>function($query) {
	$query->select(['id','parentid', 'encrypted_field']);
} ])->find(1);

dd($parent->toJson());
dd($parent->toArray());

And it worked perfect for me, can you try grabbing only one, maybe check your data, you can use a query like this directly in db: SELECT AES_DECRYPT(encrypted_column, 'ENCRYPTION_KEY') FROM table WHERE ...

Ughh perfect, i wasnt looking with that aspect, actually i was calling function which was returing data withprefix , withoutprefix and alias like if there's vn_title, so in $select_filed['alias'] it was returning contacts.vn_title , i passed array without prefix , it working smoothly now. Thanks again.

from laravel-lumen-mysql-encryption.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.