0
Wie man Kategorie in der Datenbank hinzufügt, wenn diese nicht in yii2 select2 existiert.in yii2 select2, wie Wert in der Datenbank hinzugefügt wird, wenn diese Option nicht existiert
<?=
$form->field($model, 'question_category')->widget(Select2::classname(), [
'data' => ArrayHelper::map(Category::find()->all(),'category_name','category_name'),
'maintainOrder' => true,
'toggleAllSettings' => [
'selectLabel' => '<i class="glyphicon glyphicon-ok-circle"></i> Tag All',
'unselectLabel' => '<i class="glyphicon glyphicon-remove-circle"></i> Untag All',
'selectOptions' => ['class' => 'text-success'],
'unselectOptions' => ['class' => 'text-danger'],
],
'options' => ['multiple' => true, 'placeholder' => 'Select a Category ...'],
'pluginOptions' => [
'tags' => true,
'maximumInputLength' => 10
],
]);
?>