| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | 
							- <?php
 
- namespace backend\controllers;
 
- use common\models\Suggest;
 
- use yii\data\ActiveDataProvider;
 
- use yii\filters\VerbFilter;
 
- use yii\web\Controller;
 
- use yii\web\NotFoundHttpException;
 
- use Yii;
 
- /**
 
-  * SuggestController implements the CRUD actions for Suggest model.
 
-  */
 
- class SuggestController extends Controller
 
- {
 
-     public function behaviors()
 
-     {
 
-         return [
 
-             'verbs' => [
 
-                 'class' => VerbFilter::className(),
 
-                 'actions' => [
 
-                     'delete' => ['post'],
 
-                 ],
 
-             ],
 
-         ];
 
-     }
 
-     /**
 
-      * Lists all Suggest models.
 
-      * @return mixed
 
-      */
 
-     public function actionIndex()
 
-     {
 
-         $dataProvider = new ActiveDataProvider([
 
-             'query' => Suggest::find(),
 
-             'sort' => [
 
-                 'defaultOrder' => [
 
-                     'id' => SORT_DESC
 
-                 ]
 
-             ]
 
-         ]);
 
-         return $this->render('index', [
 
-             'dataProvider' => $dataProvider,
 
-         ]);
 
-     }
 
-     /**
 
-      * Displays a single Suggest model.
 
-      * @param integer $id
 
-      * @return mixed
 
-      */
 
-     public function actionView($id)
 
-     {
 
-         return $this->render('view', [
 
-             'model' => $this->findModel($id),
 
-         ]);
 
-     }
 
-     /**
 
-      * Deletes an existing Suggest model.
 
-      * If deletion is successful, the browser will be redirected to the 'index' page.
 
-      * @param integer $id
 
-      * @return mixed
 
-      */
 
-     public function actionDelete($id)
 
-     {
 
-         $this->findModel($id)->delete();
 
-         return $this->redirect(Yii::$app->request->getReferrer());
 
-     }
 
-     /**
 
-      * Finds the Suggest model based on its primary key value.
 
-      * If the model is not found, a 404 HTTP exception will be thrown.
 
-      * @param integer $id
 
-      * @return Suggest the loaded model
 
-      * @throws NotFoundHttpException if the model cannot be found
 
-      */
 
-     protected function findModel($id)
 
-     {
 
-         if (($model = Suggest::findOne($id)) !== null) {
 
-             return $model;
 
-         } else {
 
-             throw new NotFoundHttpException('The requested page does not exist.');
 
-         }
 
-     }
 
- }
 
 
  |