/** * 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 = "Language"; $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(); } FileUtils::removeFolder(Yii::$app->params['images_folder'] . $model->image_path); return true; } return false; }