addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->created_at = time(); } public function beforeUpdate() { $this->updated_at = time(); } public function afterCreate() { $maxUserIdCache = new MaxUserIdCache(); $maxUserIdCache->rebuild(); } public static function eduRoles() { $list = [ self::EDU_ROLE_STUDENT => '学员', self::EDU_ROLE_TEACHER => '讲师', ]; return $list; } }