public function actions()
 {
     return array_merge(parent::actions(), ['index' => ['class' => 'yii\\rest\\IndexAction', 'modelClass' => $this->modelClass, 'checkAccess' => [$this, 'checkAccess'], 'prepareDataProvider' => function ($action) {
         $m = new InputParamsSearch();
         $params = \Yii::$app->getRequest()->getQueryParams();
         $dataProvider = $m->search($params);
         return $dataProvider;
     }], 'create' => ['class' => 'api\\components\\rest\\InputParamsCreateAction', 'modelClass' => $this->modelClass, 'checkAccess' => [$this, 'checkAccess']]]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = InputParamsSearch::find();
     $sort = new Sort(['attributes' => ['id', 'formula_id', 'type', 'value', 'added_on']]);
     if (!empty($params['order'])) {
         $typeOrder = $params['order'][0] == '+' ? SORT_ASC : SORT_DESC;
         $sort->defaultOrder = array(substr($params['order'], 1, strlen($params['order'])) => $typeOrder);
     }
     $pages = new Pagination();
     $perPage = isset($params['perPage']) ? $params['perPage'] : null;
     if (!empty($perPage)) {
         $pages->pageSize = $perPage;
         $pages->page = isset($params['page']) ? $params['page'] : null;
         if ($perPage == 'all') {
             $pages = false;
         }
     }
     $this->load(['CalculationSearch' => $params]);
     $query->andFilterWhere(['like', 'title', $this->value]);
     $query->andFilterWhere(['like', 'title', $this->type]);
     $query->andFilterWhere(['=', 'formula.calculation_id', \Yii::$app->getRequest()->getQueryParam('calculation_id')]);
     $query->joinWith(['formula']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => $sort, 'pagination' => $pages]);
     return $dataProvider;
 }