/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Order::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['order_id' => $this->order_id, 'user_id' => $this->user_id, 'total_price' => $this->total_price, 'shipping_fee' => $this->shipping_fee, 'payment_fee' => $this->payment_fee, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'status' => $this->status]); $query->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'memo', $this->memo]); return $dataProvider; }
/** * Finds the Order model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Order the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Order::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }