public function actionIndex($url) { $model = Page::findOne(['url' => $url]); if (!$model) { Alert::add('Strona nie została znaleziona', Alert::TYPE_ERROR); return $this->goHome(); } return $this->render('index', ['model' => $model]); }
/** * @param string $url * @return string */ public function actionIndex($url) { $model = Group::findOne(['url' => $url]); if (!$model) { Alert::add(Yii::t('msg', 'Page not found.'), Alert::TYPE_ERROR); return $this->goHome(); } return $this->render('index', ['model' => $model]); }
public function actionUpdate($id = null) { /** @var User $model */ $model = User::findOne(Yii::$app->user->getIdentity()->id); $model->setScenario('update'); if ($model->load(Yii::$app->request->post())) { if ($model->newPassword) { $model->setPassword($model->newPassword); } if ($model->save()) { Alert::add(Yii::t('msg', 'Operation completed successfully.')); } } return $this->render('update', ['model' => $model]); }
/** * Resets password. * * @param string $token * @return mixed * @throws BadRequestHttpException */ public function actionResetPassword($token) { try { $model = new ResetPasswordForm($token); } catch (InvalidParamException $e) { throw new BadRequestHttpException($e->getMessage()); } if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) { Alert::add(Yii::t('msg', 'New password was saved. Now you can log in.')); return $this->goHome(); } return $this->render('resetPassword', ['model' => $model]); }