/** * function ->delete () */ public function delete() { // $now = strtotime('now'); // $username = Yii::$app->user->identity->username; if (parent::delete()) { return true; } return false; }
/** * function ->delete () */ public function delete() { $now = strtotime('now'); $username = Yii::$app->user->identity->username; $model = $this; if ($log = new UserLog()) { $log->username = $username; $log->action = 'Delete'; $log->object_class = 'PurchaseOrder'; $log->object_pk = $model->id; $log->created_at = $now; $log->is_success = 0; $log->save(); } if (parent::delete()) { if ($log) { $log->is_success = 1; $log->save(); } return true; } return false; }