Support the ongoing development of →
Database Eloquent Architecture
Last updated 2 years ago.

So you don't want the created_at and updated_at columns to be automatically treated as dates and converted into Carbon instances?

If so you'll have to override the getDates method as it's responsible for merging in your custom dates with the defaults.

public function getDates()
    return [];
Last updated 2 years ago.

Yes, it's this. I just figured it out after reading the Eloquent\Model class code. Since I don't use updated_at I just removed it from the code:

public function getDates() {
	$defaults = array(static::UPDATED_AT);
	return array_merge($this->dates, $defaults);

But for the same reason, returning other than empty array is useless. Thanks :)

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

ranisalt ranisalt Joined 10 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.