tg bot user
This commit is contained in:
parent
b08aaec81d
commit
dd28eadf79
@ -18,6 +18,7 @@ class CreateTgBotForm extends FormModel
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 'required',
|
||||
'bot_id' => 'required',
|
||||
'dialog_id' => 'required',
|
||||
'username' => 'required',
|
||||
|
@ -16,6 +16,7 @@ class TgBotService
|
||||
public function create(FormModel $form_model): false|Tgbot
|
||||
{
|
||||
$model = new Tgbot();
|
||||
$model->user_id = $form_model->getItem('user_id');
|
||||
$model->bot_id = $form_model->getItem('bot_id');
|
||||
$model->dialog_id = $form_model->getItem('dialog_id');
|
||||
$model->user_id = $form_model->getItem('user_id');
|
||||
@ -32,6 +33,7 @@ class TgBotService
|
||||
|
||||
public function update(FormModel $form_model, Tgbot $model): false|Tgbot
|
||||
{
|
||||
$model->user_id = $form_model->getItem('user_id');
|
||||
$model->bot_id = $form_model->getItem('bot_id');
|
||||
$model->dialog_id = $form_model->getItem('dialog_id');
|
||||
$model->user_id = $form_model->getItem('user_id');
|
||||
|
@ -8,6 +8,14 @@ use app\modules\tgbot\models\Tgbot;
|
||||
$form = new \itguild\forms\ActiveForm();
|
||||
$form->beginForm(isset($model) ? "/admin/tg-bot/edit/" . $model->id : "/admin/tg-bot");
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "user_id", params: [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'User ID',
|
||||
'value' => $model->user_id ?? ''
|
||||
])
|
||||
->setLabel("User ID")
|
||||
->render();
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "bot_id", params: [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'Bot ID',
|
||||
|
Loading…
x
Reference in New Issue
Block a user