Support the ongoing development of Laravel.io →
Database Eloquent Installation
Last updated 2 years ago.
0

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();
    }
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

thassan thassan Joined 21 Mar 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.