I am working with laravel and in one of my models I need to automatically assign the value to a field (of type date) every time a record is created, as I am just starting with laravel, I do not do this, since I try with a mutator:
public function setApprovedDateAttribute($date)
{
$this->attributes['approved_date'] = Carbon::now()->format('Y-m-d');
}
but it doesn't work for me, because I think that the mutator as its name says it changes the value that I am sending for this field, in my case I need to add one automatically every time I create a new record, so how can I do this?