I have a relation between two tables - Many To Many.
I use the sync()
method to save the related models:
public function tags()
{
return $this->belongsToMany('Tag')->withTimestamps();
}
And this way I can set the timestamp fields - created_at
and updated_at
, but how can I override the format of those dates.
I have overriden the format for models using the following:
protected function getDateFormat()
{
return 'U';
}
But it doesn't seem to work when using sync()
. All records in the table are saved with the default date format.