Found my own solution:
First, I had to add the timestamps to the $dates property of the model (Profile)
protected $dates = ['created_at', 'updated_at', 'birth_date','hiring_date'];
Then I had to add mutators for the timestamps:
public function setCreatedAtAttribute($value)
{
$this->attributes['created_at'] = Carbon::now();
}
public function setUpdatedAtAttribute($value)
{
$this->attributes['updated_at'] = Carbon::now();
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community