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
#12

Go to your model
protected $useTimestamps = true;

To
protected $useTimestamps = false;
Enlightenment  Is  Freedom
Reply




Theme © iAndrew 2016 - Forum software by © MyBB