$changeOnUnsubscribed = new ContactList();
if ($changeOnUnsubscribed->load(Yii::$app->request->post())){
$contactId = ContactList::find()->where(['contact_id' => $id])->all();
foreach ($contactId as $id){
foreach ($changeOnUnsubscribed->selected_checkbox as $checkbox){
if (!$checkbox == 0){
print_r($checkbox);
if ($checkbox == $id->id){
$changeOnUnsubscribed->status = 0;
$changeOnUnsubscribed->save();
}
}
}
}
}
<div class="modal-body">
<?php $form = ActiveForm::begin([
'method' => 'post',
'id' => 'name-contact'
]); ?>
<?= $form->field($nameContact, 'name_contact')->textInput(['class' => 'form-control'])->label(Yii::t('app', 'Contact name') . ':', ['class' => 'col-form-label']) ?>
<?php ActiveForm::end(); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-main" data-dismiss="modal">
<?= Yii::t('app', 'Close') ?>
</button>
<?= Html::submitButton(Yii::t('app', 'Save changes'), ['class' => 'btn btn-sm button-success', 'form' => 'name-contact']) ?>
public $date_from = '2017-12-10';
public $date_to = '2018-01-10';
$search = ContactList::find()->where(['contact_id' => $id])->andWhere(['like', 'created', '>=', $date_from, $date_to])->with('groupContactList')->all();