/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Workstations::find(); $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(['id' => $this->id, 'cell_phone_minutes' => $this->cell_phone_minutes, 'cell_phone_monthly_cost' => $this->cell_phone_monthly_cost]); $query->andFilterWhere(['like', 'full_name', $this->full_name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'domain', $this->domain])->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'department', $this->department])->andFilterWhere(['like', 'user_name', $this->user_name])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'phone_code', $this->phone_code])->andFilterWhere(['like', 'profit_center', $this->profit_center])->andFilterWhere(['like', 'email_address', $this->email_address])->andFilterWhere(['like', 'phone_number', $this->phone_number])->andFilterWhere(['like', 'phone_model', $this->phone_model])->andFilterWhere(['like', 'cell_phone', $this->cell_phone])->andFilterWhere(['like', 'computer_name', $this->computer_name])->andFilterWhere(['like', 'ip_address', $this->ip_address])->andFilterWhere(['like', 'user_assets', $this->user_assets])->andFilterWhere(['like', 'user_idis', $this->user_idis])->andFilterWhere(['like', 'printer_idis', $this->printer_idis])->andFilterWhere(['like', 'display_idis', $this->display_idis])->andFilterWhere(['like', 'filial_idis', $this->filial_idis])->andFilterWhere(['like', 'menu_idis', $this->menu_idis])->andFilterWhere(['like', 'hidden', $this->hidden])->andFilterWhere(['like', 'cell_phone_contract', $this->cell_phone_contract])->andFilterWhere(['like', 'cell_phone_pin', $this->cell_phone_pin])->andFilterWhere(['like', 'cell_phone_puk', $this->cell_phone_puk])->andFilterWhere(['like', 'cell_phone_plan', $this->cell_phone_plan]); return $dataProvider; }
public function getWorkstations() { return $this->hasOne(Workstations::className(), ['id' => 'workstations_id']); //return $this->belongsTo(ProfitCenter::className(), ['profit_center_id']); }
/** * Finds the Workstations model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Workstations the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Workstations::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }