Skip to content

Commit

Permalink
Update TagController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ufaboy committed Oct 19, 2023
1 parent 2eac599 commit acd50c3
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions modules/api/controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,41 +68,37 @@ public function actionView($id) {
/**
* Creates a new Tag model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return string|\yii\web\Response
* @return Tag
*/
public function actionCreate() {
$model = new Tag();

if ($this->request->isPost) {
if ($model->load($this->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
return $model;
}
} else {
$model->loadDefaultValues();
}

return $this->render('create', [
'model' => $model,
]);
return $model;
}

/**
* Updates an existing Tag model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param int $id ID
* @return string|\yii\web\Response
* @return Tag
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id) {
$model = $this->findModel($id);

if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
return $model;
}

return $this->render('update', [
'model' => $model,
]);
return $model;
}

/**
Expand Down

0 comments on commit acd50c3

Please sign in to comment.