Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tariff::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'abon_pay' => $this->abon_pay, 'connect_pay' => $this->connect_pay, 'tariff_group_id' => $this->tariff_group_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'incoming', $this->incoming])->andFilterWhere(['like', 'type_attributes', $this->type_attributes]);
     return $dataProvider;
 }
 public function postChooseTariff(Request $request, ParentRepository $parentRepository)
 {
     $tariff = Tariff::find($request->get('tariff_id'));
     $parent = $this->getParent();
     $parentRepository->chooseTariff($parent, $tariff);
 }