I’m trying to auto save created_at
date on save. but i’m getting this error.
[
'created_at' => [
0 => 'Created At cannot be blank.'
]
]
i added this behaviors
in my model class
public function behaviors()
{
return [
[
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => (new \DateTime())->format('Y-m-d H:i:s'),
],
];
}
what am i doing wrong here? thanks.