slug = $form_model->getItem('slug'); $model->status = $form_model->getItem('status'); $model->title = $form_model->getItem('title'); // $model->slug = Slug::createSlug($form_model->getItem('title'), Card::class); // Генерация уникального slug if ($model->save()) { return $model; } return false; } public function update(FormModel $form_model, CardProgram $cardProgram): false|CardProgram { // Пример обновления: $cardProgram->title = $form_model->getItem('title'); $cardProgram->slug = $form_model->getItem('slug'); $cardProgram->status = $form_model->getItem('status'); if ($cardProgram->save()) { return $cardProgram; } return false; } public static function getProgramList(): array { $arr = []; foreach (CardProgram::all()->toArray() as $cardTemplate){ $arr[$cardTemplate['id']] = $cardTemplate['title']; } if (!empty($arr)) { return $arr; } return []; } }