Welcome Guest, Not a member yet? Register   Sign In
updated_at is not updating
#11

(This post was last modified: 08-20-2021, 01:28 AM by InsiteFX.)

If you all take and look at the BaseModel insert and update methods, you will see how it's done.

PHP Code:
// BaseModel Class

protected $useTimestamps true;  // if you look at the methods this has to be set to true

// The fields have to be in the database table.

-- insert method

if ($this->useTimestamps && $this->createdField && ! array_key_exists($this->createdField$data)) {
    $data[$this->createdField] = $date;
}

if (
$this->useTimestamps && $this->updatedField && ! array_key_exists($this->updatedField$data)) {
    $data[$this->updatedField] = $date;
}

-- 
update method

if ($this->useTimestamps && $this->updatedField && ! array_key_exists($this->updatedField$data)) {
    $data[$this->updatedField] = $this->setDate();



Hope that this sheds some light on this.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
updated_at is not updating - by nneves - 08-18-2021, 04:50 PM
RE: updated_at is not updating - by InsiteFX - 08-19-2021, 01:34 AM
RE: updated_at is not updating - by nneves - 08-19-2021, 02:21 AM
RE: updated_at is not updating - by ikesela - 08-19-2021, 04:12 AM
RE: updated_at is not updating - by nfaiz - 08-19-2021, 04:59 AM
RE: updated_at is not updating - by nneves - 08-19-2021, 05:25 AM
RE: updated_at is not updating - by ikesela - 08-19-2021, 12:12 PM
RE: updated_at is not updating - by craig - 08-19-2021, 07:52 AM
RE: updated_at is not updating - by wdeda - 08-19-2021, 10:28 AM
RE: updated_at is not updating - by nneves - 08-19-2021, 01:43 PM
RE: updated_at is not updating - by InsiteFX - 08-20-2021, 01:27 AM
RE: updated_at is not updating - by paliz - 08-20-2021, 05:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB