public function actionBadRecordDelete($id) { $record = RBadRecord::findOne($id); $record->record->delete(); $this->redirect(['cabinet/bad-record-index']); }
public function actionBadRecord() { $post = Yii::$app->request->post(); $id = $post["id"]; $RBadRecord = RBadRecord::findOne(["id_item" => $id]); if (!$RBadRecord) { $RBadRecord = new RBadRecord(); $RBadRecord->id_item = $id; $RBadRecord->date = time(); $RBadRecord->count = 0; $RBadRecord->save(); } $RBadRecord->addRecord(); }
public function getBadRecord() { return $this->hasOne(RBadRecord::className(), ['id_item' => 'id']); }