card_program_id = $form_model->getItem('card_program_id'); $model->slug = $form_model->getItem('slug'); $model->status = $form_model->getItem('status'); $model->type = $form_model->getItem('type'); $model->title = $form_model->getItem('title'); $model->value = $form_model->getItem('value'); // $model->slug = Slug::createSlug($form_model->getItem('title'), Card::class); // Генерация уникального slug if ($model->save()) { return $model; } return false; } public function update(FormModel $form_model, CardProgramConditions $cardProgramConditions): false|CardProgramConditions { // Пример обновления: $cardProgramConditions->title = $form_model->getItem('title'); $cardProgramConditions->slug = $form_model->getItem('slug'); $cardProgramConditions->status = $form_model->getItem('status'); $cardProgramConditions->type = $form_model->getItem('type'); $cardProgramConditions->card_program_id = $form_model->getItem('card_program_id'); $cardProgramConditions->value = $form_model->getItem('value'); if ($cardProgramConditions->save()) { return $cardProgramConditions; } return false; } }