SettingSearch.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\models;
  3. use yii\base\Model;
  4. use yii\data\ActiveDataProvider;
  5. use app\models\Settings;
  6. /**
  7. * SettingSearch represents the model behind the search form of `app\models\Settings`.
  8. */
  9. class SettingSearch extends Settings
  10. {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function rules()
  15. {
  16. return [
  17. [['id', 'invoce', 'act', 'time', 'created_at', 'updated_at'], 'integer'],
  18. ];
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function scenarios()
  24. {
  25. // bypass scenarios() implementation in the parent class
  26. return Model::scenarios();
  27. }
  28. /**
  29. * Creates data provider instance with search query applied
  30. *
  31. * @param array $params
  32. *
  33. * @return ActiveDataProvider
  34. */
  35. public function search($params)
  36. {
  37. $query = Settings::find();
  38. // add conditions that should always apply here
  39. $dataProvider = new ActiveDataProvider([
  40. 'query' => $query,
  41. ]);
  42. $this->load($params);
  43. if (!$this->validate()) {
  44. // uncomment the following line if you do not want to return any records when validation fails
  45. // $query->where('0=1');
  46. return $dataProvider;
  47. }
  48. // grid filtering conditions
  49. $query->andFilterWhere([
  50. 'id' => $this->id,
  51. 'invoce' => $this->invoce,
  52. 'act' => $this->act,
  53. 'time' => $this->time,
  54. 'created_at' => $this->created_at,
  55. 'updated_at' => $this->updated_at,
  56. ]);
  57. return $dataProvider;
  58. }
  59. }