private static function archiveOther($user_id = NULL)
 {
     if (!is_null($user_id)) {
         Handycap::updateAll(['status' => 'archived'], 'status <> "archived" AND user_id = ' . $this->user_id);
     }
     return true;
 }
 public function search($params)
 {
     $query = Handycap::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'hcp' => $this->hcp, 'time_deleted' => $this->time_deleted, 'time_create' => $this->time_create]);
     $query->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
 /**
  * Finds the Handycap model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Handycap the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Handycap::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }