/** * Finds the Account model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param int $id * * @return Account the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { $id = Uuid::str2uuid($id); $payment = Payment::findOne($id); if ($payment === null) { throw new NotFoundHttpException('The requested page does not exist'); } return $payment; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params, $accountId = null) { $query = BasePayment::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 10)]); $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'account_id' => $accountId, 'status' => $this->status, 'amount' => $this->amount, 'created_at' => $this->created_at, 'created_by' => $this->created_by]); $query->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }