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

Crazylife's avatar

How to save null value into date column format?

I am having trouble when trying to update date column with null value. I found that null value unable to override the value stored in the date column. How can i update it with null value?

0 likes
7 replies
chrispage1's avatar

As long as the column in your database table is nullable this shouldn't be a problem.

Crazylife's avatar

My table already set to nullable, but it doesn't taking any effect. It will auto set to today's date.

MichalOravec's avatar

So post your model and code where are you trying to update it.

Crazylife's avatar

It's just simple date format column. Already set ->nullable()->default(null) for table.

$track = new Track();
$track->parcel_delivery_date = null; // when i pass null it will automatic set as today's date
$track->save()

Just something like.

Please or to participate in this conversation.