private function logTrace($tag) { foreach (Yii::$app->request->post('data') as $message) { $_msg = new LogmanTraces(); $_msg->request_tag = $tag; foreach ($message as $partId => $part) { $_msg->{$partId} = $part; } $_msg->save(); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = LogmanTraces::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'line' => $this->line, 'level' => $this->level, 'time' => $this->time]); $query->andFilterWhere(['like', 'request_tag', $this->request_tag])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'message_full', $this->message_full])->andFilterWhere(['like', 'message_short', $this->message_short])->andFilterWhere(['like', 'message_all', $this->message_all])->andFilterWhere(['like', 'file', $this->file])->andFilterWhere(['like', 'additional', $this->additional])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'traces', $this->traces]); return $dataProvider; }
/** * Finds the LogmanTraces model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return LogmanTraces the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = LogmanTraces::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getLogmanTraces() { return $this->hasMany(LogmanTraces::className(), ['request_tag' => 'tag']); }