Skip to main content

Model $casts: Dates, Enum and More

Premium
3:44

The Full Lesson is Only for Premium Members

Want to access all of our courses? (36 h 00 min)

You also get:

61 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Mahmudul Haque avatar

Array casting does not work for the postgres database. is it possible to check and share the possible solution? thank you

Povilas Korop avatar

Unfortunately I don't think there's a possible solution if postgres just doesn't support it.

👍 1
Mahmudul Haque avatar

okay thank you

Johan Montenij avatar

Very interesting tip about the Enum-casting! Especially since there isn't that much in the documentation about this yet.

👍 2
Kailash Vele avatar

Hey, Can we do encryption while storing into and database and decrypt while showing the data to frontend.

Povilas Korop avatar

With newer Laravel version, the encryption came as casts. But it's a ONE-WAY encryption, without decryption.

Kailash Vele avatar

Can you suggest me some encryption and decription package for this senario. As we all are dealing with larage user data there might be chances of the datbase hacke and data leak.

Povilas Korop avatar

Yes, but from the other hand, if you want to encrypt/decrypt data on every query, it would MASSIVELY slow down the application. Do you really want that?

Kailash Vele avatar

Can you point me in the right direction with some article link or video, to understand the Best practices.

Povilas Korop avatar

Encryption in general is a huge topic, not sure which articles or videos I can point you to. In my experience, I've never used real database encryption except for fields like passwords, because I never cared about data security more than performance, and data security comes from the fact that the server itself is protectec enough.

But if you have other opinion, you may start any bigger tutorial/course on database encryption.