public function run($id = null)
 {
     if ($id == null) {
         $searchModel = new ContactSearch();
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         return $this->controller->render('contact', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     } else {
         $model = Contact::findOne($id);
         $model->status = 1;
         $model->save();
         return $this->controller->render('_contact', ['model' => $model]);
     }
 }
 /**
  * Finds the Contact model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Contact the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Contact::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionDetail($id)
 {
     $model = Contact::findOne($id);
     return $this->render('detail', ['model' => $model]);
 }