bot_id = $form_model->getItem('bot_id'); $model->dialog_id = $form_model->getItem('dialog_id'); $model->user_id = $form_model->getItem('user_id'); $model->username = $form_model->getItem('username'); $model->first_name = $form_model->getItem('first_name'); $model->last_name = $form_model->getItem('last_name'); $model->status = $form_model->getItem('status'); if ($model->save()){ return $model; } return false; } public function update(FormModel $form_model, Tgbot $model): false|Tgbot { $model->bot_id = $form_model->getItem('bot_id'); $model->dialog_id = $form_model->getItem('dialog_id'); $model->user_id = $form_model->getItem('user_id'); $model->username = $form_model->getItem('username'); $model->first_name = $form_model->getItem('first_name'); $model->last_name = $form_model->getItem('last_name'); $model->status = $form_model->getItem('status'); if ($model->save()){ return $model; } return false; } }