/** * @override * Save the model to the database. * * This function will automatically determine if an INSERT or UPDATE needs to occur. * If a validation or a callback for this model returns false, then the model will * not be saved and this will return false. * * If saving an existing model only data that has changed will be saved. * * @param boolean $validate Set to true or false depending on if you want the validators to run or not * @return boolean True if the model was saved to the database otherwise false */ public function save($validate = true) { if ($this->is_new_record()) { $dt = new \DateTime(); //var_dump($dt->getTimestamp()); $this->set_attributes(array($this->get_primary_key() => ZiUtil::GetTransID())); } //still use save parent return parent::save($validate); }
public function addTemp() { $req = App::request(); $get = $req->get(); $attributes = array("entry_jenis_nama" => $get["nama"], "entry_jenis_id" => ZiUtil::GetTransID()); $table = StokEntryJenis::table(); $table->insert($attributes); }