public function actionUpdate($id, $type = null) { // Find Model $model = TemplateService::findById($id); // Update/Render if exist if (isset($model)) { $model->setScenario('update'); if ($model->load(Yii::$app->request->post(), 'Template') && $model->validate()) { if (TemplateService::update($model)) { return $this->redirect($this->returnUrl); } } return $this->render('@cmsgears/module-core/admin/views/template/update', ['model' => $model]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }