public function search($params)
 {
     $query = OrdersHandler::find()->where(['status' => OrdersHandler::STATUS_SENDED]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         //$query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     //$userFoundCod = $this->getUsersFoundCod();
     //if(isset($userFoundCod)) {
     //    foreach ($userFoundCod as $user) {
     //        $query->andFilterWhere([
     //            'user_id' => $user->id
     //        ]);
     //    }
     //}
     $query->andFilterWhere(['in', 'user_id', $this->codUser ? $this->getUsersFoundCod() : null]);
     $query->andFilterWhere(['user_id' => $this->nameUser ? $this->getUsersFoundName() : null]);
     return $dataProvider;
 }
 /**
  * Finds the Orders model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Orders the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = OrdersHandler::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }