/** * Initiate join date and last activity value */ public function afterConstruct() { if ($this->scenario == 'insert') { $this->joinDate = date('Y-m-d H:i:s'); } return parent::afterConstruct(); }