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

JackD's avatar

add days to displayed created_at date

Hi,

i have this in my view page, im trying to add 5 days on the created_at in my record to display, but it does not adds up to the created_at date.

Created at
{!! $row->created_at  !!}

Will expire on
{!! $row->created_at->addDays(5) !!}

Regards, Ci

0 likes
4 replies
TimSch's avatar

Do you have created_at in your dates array in the model?

For example:

protected $dates = ['created_at'];
JackD's avatar

@Akhanto yes i can display already the {!! $row->created_at !!} with values coming from database, my problem is that how can i add days to the displayed created_at to show that it will expired within number of days

TimSch's avatar

You're doing it right.. Could you show some of your code? There must be an error somewhere.

RachidLaasri's avatar

Do you get any errors when trying to add days using this ?

{!! $row->created_at->addDays(5) !!}

Please or to participate in this conversation.