pmtpenza

Untitled

Jun 29th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?php
  2.  
  3. namespace backend\models;
  4.  
  5. use yii\base\Model;
  6. use yii\data\ActiveDataProvider;
  7. use backend\models\Zayvki;
  8.  
  9. /**
  10. * ZayvkiSearch represents the model behind the search form of `backend\models\Zayvki`.
  11. */
  12. class ZayvkiSearch extends Zayvki
  13. {
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public function rules()
  18. {
  19. return [
  20. [['id', 'user_id', 'status', 'master', 'uk', 'typeuslug','oplata_id'], 'integer'],
  21. [['create_at', 'data_vyp'], 'safe'],
  22. ];
  23. }
  24.  
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function scenarios()
  29. {
  30. // bypass scenarios() implementation in the parent class
  31. return Model::scenarios();
  32. }
  33.  
  34. /**
  35. * Creates data provider instance with search query applied
  36. *
  37. * @param array $params
  38. *
  39. * @return ActiveDataProvider
  40. */
  41. public function search($params)
  42. {
  43. $query = Zayvki::find();
  44.  
  45. // add conditions that should always apply here
  46.  
  47. $dataProvider = new ActiveDataProvider([
  48. 'query' => $query,
  49. ]);
  50.  
  51. $this->load($params);
  52.  
  53. if (!$this->validate()) {
  54. // uncomment the following line if you do not want to return any records when validation fails
  55. // $query->where('0=1');
  56. return $dataProvider;
  57. }
  58.  
  59. // grid filtering conditions
  60. $query->andFilterWhere([
  61. 'id' => $this->id,
  62. 'user_id' => $this->user_id,
  63. 'status' => $this->status,
  64. 'master' => $this->master,
  65. 'uk' => $this->uk,
  66. 'create_at' => $this->create_at,
  67. 'oplata_id' => $this->oplata_id,
  68. 'data_vyp' => $this->data_vyp,
  69. 'typeName' => $this->typeName,
  70. ]);
  71.  
  72. $query= Uslugi::find()
  73. ->joinWith(['order'] );
  74.  
  75. return $dataProvider;
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment