How to add additional value in ArrayHelper?

Hi,

I have a drop down list in my admin panel and I would like to select a single user or select all users.

I have following code:


   <?= $form->field($model, 'for_user')->dropDownList(

		ArrayHelper::map(UserRabat::find()->all(),'id','username'),

		['prompt'=>'Select user']

	) ?>

How should I add additional value "All users" in ArrayHelper?

ArrayHelper return an array, than you can use array_merge for merge anymore arrays

1 Like