public function actionDelete($id) { $model = Stations::findOne($id); if (!empty($model)) { $model->record_status = STATUS_DELETED; if ($model->save()) { return $this->redirect(['station/index']); } } }
function actionSetComment() { $mentor = Mentor::findOne(['token' => $this->get["token"]]); $station = Stations::findOne(['hash' => $this->get["hash"]]); $kids = Kids::findOne(['qr' => $this->get["qr"]]); if (!$mentor) { $r = $this->setError(205); } elseif (!$station) { $r = $this->setError(101); } elseif (!$kids) { $r = $this->setError(301); } else { $r["status"] = "ok"; $comment_kids = new CommentKids(); $comment_kids->id_kids = $kids->id; $comment_kids->id_mentor = $mentor->id; $comment_kids->id_station = $station->id; $comment_kids->date = time(); $comment_kids->text = $this->get["text"]; $comment_kids->save(); } //$comment_kids = new CommentKids; return json_encode($r); }