public function add($meeting_id, $action, $actor_id, $item_id, $extra_id = 0) { $log = new MeetingLog(); $log->meeting_id = $meeting_id; $log->action = $action; $log->actor_id = $actor_id; $log->item_id = $item_id; $log->extra_id = $extra_id; $log->save(); }
/** * Finds the MeetingLog model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MeetingLog the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MeetingLog::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MeetingLog::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'meeting_id' => $this->meeting_id, 'action' => $this->action, 'actor_id' => $this->actor_id, 'item_id' => $this->item_id, 'extra_id' => $this->extra_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getMeetingLogs() { return $this->hasMany(MeetingLog::className(), ['meeting_id' => 'id']); }