Пример #1
0
 public function actionDetail($id)
 {
     if (!empty($id)) {
         $new = News::findOne($id);
         $user_exp = TUser::find()->select('name,level')->orderBy('totalexp DESC')->limit(9)->all();
         return $this->render('detail', ['new' => $new, 'users' => $user_exp]);
     }
 }
Пример #2
0
 public function actionRemove($id)
 {
     if (!empty($id)) {
         $news = News::findOne($id);
         if (!empty($news)) {
             $result = $news->delete();
             if ($result) {
                 return $this->redirect('index');
             } else {
                 \Yii::$app->session->setFlash('error', "Xóa không thành công");
             }
         }
     }
 }