Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Abdullah_Iftikhar's avatar

Expiry date Issue in laravel

How i can identified this document is expired or not.

Like a person have document expiry date is 11-12-2019

how can i identified it's document expired or not.

0 likes
4 replies
Sinnbeck's avatar

Do you mean you need to check a date of a document on the server or are you refering to a column in the database?

Or are you talking about session/cookie expiration?

Please spend a few minutes explaining exactly what you are trying to do.

Cruorzy's avatar

No idea what you mean since the post is very limited in information...

Carbon::now() against a date stored in the database.

Give more information, for example "this document" well what document?

Abdullah_Iftikhar's avatar

I have expiry date column in database i want to check it it's passed or not if this date is passed the i will show expired status.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

If it already casts to a date when getting it using eloquent you can check like this

$result->expiry_date >= Carbon::now();

If this makes no sense to you, please paste your own code so I can help you to get it working.

3 likes

Please or to participate in this conversation.