Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Model $casts: Dates, Enum and More

Premium
3:44

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

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

Already a member? Login here

Comments & Discussion

MH
Mahmudul Haque ✓ Link copied!

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

PK
Povilas Korop ✓ Link copied!

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

MH
Mahmudul Haque ✓ Link copied!

okay thank you

JM
Johan Montenij ✓ Link copied!

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

KV
Kailash Vele ✓ Link copied!

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

PK
Povilas Korop ✓ Link copied!

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

KV
Kailash Vele ✓ Link copied!

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.

PK
Povilas Korop ✓ Link copied!

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?

KV
Kailash Vele ✓ Link copied!

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

PK
Povilas Korop ✓ Link copied!

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.