/** * @param int $id * @return Response * @throws NotFoundHttpException * @throws \Exception */ public function run($id) { /** @var Language $model */ $model = Language::findOne($id); if ($model === null) { throw new NotFoundHttpException('The requested language does not exist.'); } $model->delete(); return $this->controller->redirect(['view']); }
/** * @param $id * @return string|Response * @throws NotFoundHttpException */ public function run($id) { /** @var Language $model */ $model = Language::findOne($id); if ($model === null) { throw new NotFoundHttpException('The requested language does not exist.'); } if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->controller->redirect(['update', 'id' => $model->id]); } return $this->controller->render('update', ['model' => $model]); }