public static function addlog($username, $step) { $model = new Operating(); $model->username = $username; $model->step = $step; $model->save(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Operating::find()->orderBy('id DESC'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $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]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'step', $this->step])->andFilterWhere(['like', 'created_at', $this->created_at])->andFilterWhere(['like', 'updated_at', $this->updated_at]); return $dataProvider; }
/** * Finds the Operating model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Operating the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Operating::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Deletes an existing Thirdproduct model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { //$this->findModel($id)->delete(); Thirdproduct::updateAll(['status' => Thirdproduct::STATUS_DELETED], ['id' => $id]); Operating::addlog(\App::$app->user->identity->username, '删除第三方债权'); return $this->redirect(['index']); }