how to prevent timestamp for Update when just Inserting |
how i can prevent ' updated_at ' column to not update when Inserting... while using ' protected $useTimestamps = true; ' in Model
when i will display data to management which records updated, then all inserted records will come up because 'updated_at' column is not null. OR any other better way to timestamping these fields/columns separately with Insert and Update? regards Edit: ok, i found the solution while googling: ALTER TABLE t1 MODIFY created_at DATETIME DEFAULT CURRENT_TIMESTAMP, MODIFY updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP; please advise if any other better way. |
Welcome Guest, Not a member yet? Register Sign In |