200], ['number','string','max' =>200] ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } public function attributeLabels(){ return ArrayHelper::merge(parent::attributeLabels(), [ 'card_number' => 'Kártya szám', 'customerName' => 'Vendég' ] ); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = new Query(); $query->select(['card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']); $query->from('card'); $query->innerJoin('customer','card.id_card = customer.id_customer_card'); $query->orderBy(['customer.name' => SORT_ASC]); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere([ // 'lower(customer.name)' => $this->customerName ]); $query->andFilterWhere(['like', 'customer.name', $this->customerName]); return $dataProvider; } }