Hi @mostafalaravel
From the docs: https://laravel.com/docs/5.8/eloquent-mutators#date-mutators
Date Formats
By default, timestamps are formatted as 'Y-m-d H:i:s'. If you need to customize the timestamp format, set the $dateFormat property on your model. This property determines how date attributes are stored in the database, as well as their format when the model is serialized to an array or JSON:
So try something like:
Model with the unique date
class YourModel extends Model
{
/**
* The storage format of the model's date columns.
*
* @var string
*/
protected $dateFormat = "Y-m-d\TH:i:s\+u'';
}
I wasn't really sure what you were going for with the 00:00, I assumed milliseconds. But be careful with the precision amount and potentially an improper date format (where Carbon might blow up). If there are issues, try storing the dates as a string instead of a date time. Or, and perhaps this is the easier solution depending on your use-case, just store the updated_at field the standard way Y-m-d H:i:s and the use an accessor mutator when pulling the date from the DB:
Model with the unique date
class YourModel extends Model
{
public function getUpdatedAtAttribute($value)
{
$this->attributes['updated_at'] = $value->format('Y-m-d\TH:i:s\+u');
}
}