Using Laravel 4.2 and the DB Class (I'm not allowed to use Eloquent)
How do I update a timestamp field with the DB Class in Laravel 4.2?
Table creation
CREATE TABLE posts
(
id INTEGER PRIMARY KEY,
title VARCHAR(255) NOT NULL,
message VARCHAR(50000) NOT NULL,
author VARCHAR(255) NOT NULL,
avatar VARCHAR(255),
created_at DATETIME DEFAULT (DATETIME(CURRENT_TIMESTAMP, 'LOCALTIME')),
updated_at DATETIME DEFAULT (DATETIME(CURRENT_TIMESTAMP, 'LOCALTIME'))
);
Update row
$post = DB::update('UPDATE posts SET title=?,message=?,author=?,updated_at=? WHERE id=?',
array(
Input::get('title'),
Input::get('message'),
Input::get('author'),
CURRENT_TIMESTAMP, <-- Throwing error, what do I put here???
$id
)
);
Throws this error
Use of undefined constant CURRENT_TIMESTAMP - assumed 'CURRENT_TIMESTAMP'