/**
  * Finds the Link model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Link the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Link::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('app', 'PAGE_NOT_FOUND'));
     }
 }
 protected function findModel($id)
 {
     if (($model = Link::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('未找到id为[' . $id . ']的链接');
     }
 }
Exemple #3
0
 /**
  * Finds the Link model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Link the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Link::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #4
0
 /**
  * Find model by short code
  *
  * @param $shortCode
  * @return null|Link
  * @throws NotFoundHttpException
  */
 protected function findModelByShortCode($shortCode)
 {
     $model = Link::findOne(['short_code' => $shortCode]);
     if (!$model) {
         throw new NotFoundHttpException('The requested link doesn\'t exist');
     }
     return $model;
 }
Exemple #5
0
 function actionAjaxdelete($id = null)
 {
     $link = Link::findOne($id);
     if ($link != null and $link['admin_id'] == Yii::$app->user->id) {
         if ($link->delete()) {
             echo '...';
         }
     } else {
         echo 'нет данных...';
     }
 }
 public function actionGo($id)
 {
     User::loginGuest();
     if (($link = Link::findOne($id)) !== null) {
         if (LinkStats::create($id) === true) {
             $this->redirect($link->href);
         } else {
             throw new NotFoundHttpException('Запрошеная страница не найдена.');
         }
     } else {
         throw new NotFoundHttpException('Запрошеная страница не найдена.');
     }
 }