I'm using JTable for CRUD on my application. I've created method in model to save data in database
I need to add custom inputs "created" and "created_by" as shown in "$custom_data" variable and save it in database. Please note that, $form_data is getting saved successfully.
public function create() {
$table = $this->getTable();
$jinput = JFactory::getApplication()->input->post;
$form_data = $jinput->get('jform', array(), 'array');
$custom_data = array(
'created' => JFactory::getDate()->toSql(),
'created_by' => JFactory::getUser()->id
);
if (!$table->save($form_data)) {
JError::raiseNotice(500, $table->getError());
return FALSE;
}
return $form_data;
}