Hi, I'm getting a problem with my "created_at" field.
CREATE TABLE `posts` (
`title_id` bigint(20) unsigned NOT NULL,
`episode_id` bigint(20) unsigned DEFAULT NULL,
`lang_id` int(11) unsigned NOT NULL DEFAULT '0',
`file` mediumtext NOT NULL,
`uploaded_by` bigint(20) unsigned DEFAULT NULL,
`verified_by` bigint(20) unsigned DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`id` bigint(11) DEFAULT NULL,
PRIMARY KEY (`title_id`,`lang_id`),
KEY `lang_id` (`lang_id`),
KEY `uploaded_by` (`uploaded_by`),
KEY `verified_by` (`verified_by`),
KEY `episode_id` (`episode_id`),
CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`title_id`) REFERENCES `titles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `posts_ibfk_2` FOREIGN KEY (`lang_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `postss_ibfk_3` FOREIGN KEY (`uploaded_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`verified_by`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `posts_ibfk_5` FOREIGN KEY (`episode_id`) REFERENCES `episodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Inside my model:
public function beforeCreate()
{
$this->created_at = date("Y-m-d H:i:s");
}
Error on save: "created_at is required"